diff options
| author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2012-03-02 01:24:13 (GMT) |
|---|---|---|
| committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2012-03-02 01:24:13 (GMT) |
| commit | 2f24d98df08fbed8e7c82a3de1843ef27b779739 (patch) | |
| tree | 038b097ad8c79e0a8f558437990fedd576f39377 /Lib/test/regrtest.py | |
| parent | be52d507d2ada0d13ad9e482f00908173d8900f0 (diff) | |
| parent | f959618142888fab373c43edd35f20506a9740dc (diff) | |
| download | cpython-2f24d98df08fbed8e7c82a3de1843ef27b779739.zip cpython-2f24d98df08fbed8e7c82a3de1843ef27b779739.tar.gz cpython-2f24d98df08fbed8e7c82a3de1843ef27b779739.tar.bz2 | |
Closes #14158: merged test file resilience fix from 3.2.
Diffstat (limited to 'Lib/test/regrtest.py')
| -rwxr-xr-x | Lib/test/regrtest.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 871ae61..44d3426 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -749,10 +749,10 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, if bad: print(count(len(bad), "test"), "failed:") printlist(bad) - if environment_changed: - print("{} altered the execution environment:".format( - count(len(environment_changed), "test"))) - printlist(environment_changed) + if environment_changed: + print("{} altered the execution environment:".format( + count(len(environment_changed), "test"))) + printlist(environment_changed) if skipped and not quiet: print(count(len(skipped), "test"), "skipped:") printlist(skipped) @@ -970,6 +970,7 @@ class saved_test_environment: 'multiprocessing.process._dangling', 'sysconfig._CONFIG_VARS', 'sysconfig._SCHEMES', 'packaging.command._COMMANDS', 'packaging.database_caches', + 'support.TESTFN', ) def get_sys_argv(self): @@ -1163,6 +1164,20 @@ class saved_test_environment: sysconfig._SCHEMES._sections.clear() sysconfig._SCHEMES._sections.update(saved[2]) + def get_support_TESTFN(self): + if os.path.isfile(support.TESTFN): + result = 'f' + elif os.path.isdir(support.TESTFN): + result = 'd' + else: + result = None + return result + def restore_support_TESTFN(self, saved_value): + if saved_value is None: + if os.path.isfile(support.TESTFN): + os.unlink(support.TESTFN) + elif os.path.isdir(support.TESTFN): + shutil.rmtree(support.TESTFN) def resource_info(self): for name in self.resources: |
