Add --tempdir option for test run (GH-10322)
This commit is contained in:
parent
5a087d5401
commit
38df97a03c
|
@ -17,7 +17,7 @@ steps:
|
||||||
- script: python.bat -m test.pythoninfo
|
- script: python.bat -m test.pythoninfo
|
||||||
displayName: 'Display build info'
|
displayName: 'Display build info'
|
||||||
|
|
||||||
- script: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 --junit-xml="$(Build.BinariesDirectory)\test-results.xml"
|
- script: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 --junit-xml="$(Build.BinariesDirectory)\test-results.xml" --tempdir="$(Build.BinariesDirectory)\test"
|
||||||
displayName: 'Tests'
|
displayName: 'Tests'
|
||||||
env:
|
env:
|
||||||
PREFIX: $(Py_OutDir)\$(arch)
|
PREFIX: $(Py_OutDir)\$(arch)
|
||||||
|
|
|
@ -271,7 +271,8 @@ def _create_parser():
|
||||||
group.add_argument('--junit-xml', dest='xmlpath', metavar='FILENAME',
|
group.add_argument('--junit-xml', dest='xmlpath', metavar='FILENAME',
|
||||||
help='writes JUnit-style XML results to the specified '
|
help='writes JUnit-style XML results to the specified '
|
||||||
'file')
|
'file')
|
||||||
|
group.add_argument('--tempdir', dest='tempdir', metavar='PATH',
|
||||||
|
help='override the working directory for the test run')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
@ -383,8 +384,7 @@ def _parse_args(args, **kwargs):
|
||||||
if ns.match_filename:
|
if ns.match_filename:
|
||||||
if ns.match_tests is None:
|
if ns.match_tests is None:
|
||||||
ns.match_tests = []
|
ns.match_tests = []
|
||||||
filename = os.path.join(support.SAVEDCWD, ns.match_filename)
|
with open(ns.match_filename) as fp:
|
||||||
with open(filename) as fp:
|
|
||||||
for line in fp:
|
for line in fp:
|
||||||
ns.match_tests.append(line.strip())
|
ns.match_tests.append(line.strip())
|
||||||
|
|
||||||
|
|
|
@ -550,12 +550,12 @@ class Regrtest:
|
||||||
|
|
||||||
def main(self, tests=None, **kwargs):
|
def main(self, tests=None, **kwargs):
|
||||||
global TEMPDIR
|
global TEMPDIR
|
||||||
|
self.ns = self.parse_args(kwargs)
|
||||||
|
|
||||||
if sysconfig.is_python_build():
|
if self.ns.tempdir:
|
||||||
try:
|
TEMPDIR = self.ns.tempdir
|
||||||
os.mkdir(TEMPDIR)
|
|
||||||
except FileExistsError:
|
os.makedirs(TEMPDIR, exist_ok=True)
|
||||||
pass
|
|
||||||
|
|
||||||
# Define a writable temp dir that will be used as cwd while running
|
# 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
|
# the tests. The name of the dir includes the pid to allow parallel
|
||||||
|
@ -571,8 +571,6 @@ class Regrtest:
|
||||||
self._main(tests, kwargs)
|
self._main(tests, kwargs)
|
||||||
|
|
||||||
def _main(self, tests, kwargs):
|
def _main(self, tests, kwargs):
|
||||||
self.ns = self.parse_args(kwargs)
|
|
||||||
|
|
||||||
if self.ns.huntrleaks:
|
if self.ns.huntrleaks:
|
||||||
warmup, repetitions, _ = self.ns.huntrleaks
|
warmup, repetitions, _ = self.ns.huntrleaks
|
||||||
if warmup < 1 or repetitions < 1:
|
if warmup < 1 or repetitions < 1:
|
||||||
|
|
Loading…
Reference in New Issue