diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -1555,13 +1555,9 @@ except FileExistsError: pass - # 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 - # testing (see the -j option). - TESTCWD = 'test_python_{}'.format(os.getpid()) + TESTCWD = os.path.join(TEMPDIR, 'test') + return TEMPDIR, TESTCWD - TESTCWD = os.path.join(TEMPDIR, TESTCWD) - return TEMPDIR, TESTCWD if __name__ == '__main__': # Remove regrtest.py's own directory from the module search path. Despite @@ -1591,5 +1587,5 @@ # 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): + with support.temp_cwd(quiet=True, path=TESTCWD): main()