summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/libregrtest/cmdline.py6
-rw-r--r--Lib/test/libregrtest/main.py12
2 files changed, 8 insertions, 10 deletions
diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py
index 538ff05..0927032 100644
--- a/Lib/test/libregrtest/cmdline.py
+++ b/Lib/test/libregrtest/cmdline.py
@@ -271,7 +271,8 @@ def _create_parser():
group.add_argument('--junit-xml', dest='xmlpath', metavar='FILENAME',
help='writes JUnit-style XML results to the specified '
'file')
-
+ group.add_argument('--tempdir', dest='tempdir', metavar='PATH',
+ help='override the working directory for the test run')
return parser
@@ -383,8 +384,7 @@ def _parse_args(args, **kwargs):
if ns.match_filename:
if ns.match_tests is None:
ns.match_tests = []
- filename = os.path.join(support.SAVEDCWD, ns.match_filename)
- with open(filename) as fp:
+ with open(ns.match_filename) as fp:
for line in fp:
ns.match_tests.append(line.strip())
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index 1fd4132..a8d27ae 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -550,12 +550,12 @@ class Regrtest:
def main(self, tests=None, **kwargs):
global TEMPDIR
+ self.ns = self.parse_args(kwargs)
- if sysconfig.is_python_build():
- try:
- os.mkdir(TEMPDIR)
- except FileExistsError:
- pass
+ if self.ns.tempdir:
+ TEMPDIR = self.ns.tempdir
+
+ os.makedirs(TEMPDIR, exist_ok=True)
# Define a writable temp dir that will be used as cwd while running
# the tests. The name of the dir includes the pid to allow parallel
@@ -571,8 +571,6 @@ class Regrtest:
self._main(tests, kwargs)
def _main(self, tests, kwargs):
- self.ns = self.parse_args(kwargs)
-
if self.ns.huntrleaks:
warmup, repetitions, _ = self.ns.huntrleaks
if warmup < 1 or repetitions < 1: