summaryrefslogtreecommitdiffstats
path: root/Lib/test/__main__.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/__main__.py')
-rw-r--r--Lib/test/__main__.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/__main__.py b/Lib/test/__main__.py
new file mode 100644
index 0000000..ce5615b
--- /dev/null
+++ b/Lib/test/__main__.py
@@ -0,0 +1,13 @@
+from test import regrtest, support
+
+
+TEMPDIR, TESTCWD = regrtest._make_temp_dir_for_build(regrtest.TEMPDIR)
+regrtest.TEMPDIR = TEMPDIR
+regrtest.TESTCWD = TESTCWD
+
+# Run the tests in a context manager that temporary changes the CWD to a
+# temporary and writable directory. If it's not possible to create or
+# change the CWD, the original CWD will be used. The original CWD is
+# available from support.SAVEDCWD.
+with support.temp_cwd(TESTCWD, quiet=True):
+ regrtest.main()