Message322464
To clarify, TEMPDIR in this case is from the following code in Lib/test/libregrtest/main.py:
# When tests are run from the Python build directory, it is best practice
# to keep the test files in a subfolder. This eases the cleanup of leftover
# files using the "make distclean" command.
if sysconfig.is_python_build():
TEMPDIR = sysconfig.get_config_var('abs_builddir')
if TEMPDIR is None:
# bpo-30284: On Windows, only srcdir is available. Using abs_builddir
# mostly matters on UNIX when building Python out of the source tree,
# especially when the source tree is read only.
TEMPDIR = sysconfig.get_config_var('srcdir')
TEMPDIR = os.path.join(TEMPDIR, 'build')
else:
TEMPDIR = tempfile.gettempdir()
TEMPDIR = os.path.abspath(TEMPDIR)
Then in class Regrtest we have:
def main(self, tests=None, **kwargs):
global TEMPDIR
if sysconfig.is_python_build():
try:
os.mkdir(TEMPDIR)
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).
test_cwd = 'test_python_{}'.format(os.getpid())
test_cwd = os.path.join(TEMPDIR, test_cwd)
# Run the tests in a context manager that temporarily 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(test_cwd, quiet=True):
self._main(tests, kwargs) |
|
Date |
User |
Action |
Args |
2018-07-27 05:39:18 | eryksun | set | recipients:
+ eryksun, tim.golden |
2018-07-27 05:39:18 | eryksun | set | messageid: <1532669958.14.0.56676864532.issue34240@psf.upfronthosting.co.za> |
2018-07-27 05:39:18 | eryksun | link | issue34240 messages |
2018-07-27 05:39:17 | eryksun | create | |
|