summaryrefslogtreecommitdiff
path: root/Lib/test/libregrtest/main.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2018-11-17 04:14:36 -0800
committerGitHub <noreply@github.com>2018-11-17 04:14:36 -0800
commit38df97a03c5102e717a110ab69bff8e5c9ebfd08 (patch)
tree00ffb104fac76a29dd09ba91d7af302df7f493af /Lib/test/libregrtest/main.py
parent5a087d5401e6956cf4c6d95f15fedabf39a4f5af (diff)
downloadcpython-git-38df97a03c5102e717a110ab69bff8e5c9ebfd08.tar.gz
Add --tempdir option for test run (GH-10322)
Diffstat (limited to 'Lib/test/libregrtest/main.py')
-rw-r--r--Lib/test/libregrtest/main.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index 1fd41320d1..a8d27ae5f3 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: