cpython: bed806c9eb4c (original) (raw)
Mercurial > cpython
changeset 95255:bed806c9eb4c
Issue #22390: test.regrtest now emits a warning if temporary files or directories are left after running a test. [#22390]
Serhiy Storchaka storchaka@gmail.com | |
---|---|
date | Mon, 30 Mar 2015 01:30:22 +0300 |
parents | 4d5826fa77a1(current diff)05e6bab4db8f(diff) |
children | e93eeadef0c3 |
files | Lib/test/regrtest.py Misc/NEWS |
diffstat | 2 files changed, 14 insertions(+), 15 deletions(-)[+] [-] Lib/test/regrtest.py 26 Misc/NEWS 3 |
line wrap: on
line diff
--- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -1031,7 +1031,7 @@ class saved_test_environment: # to a thread, so check processes first. 'multiprocessing.process._dangling', 'threading._dangling', 'sysconfig._CONFIG_VARS', 'sysconfig._INSTALL_SCHEMES',
'support.TESTFN', 'locale', 'warnings.showwarning',[](#l1.7)
'files', 'locale', 'warnings.showwarning',[](#l1.8) )[](#l1.9)
def get_sys_argv(self): @@ -1187,20 +1187,16 @@ class saved_test_environment: sysconfig._INSTALL_SCHEMES.clear() sysconfig._INSTALL_SCHEMES.update(saved[2])
- def get_support_TESTFN(self):
if os.path.isfile(support.TESTFN):[](#l1.17)
result = 'f'[](#l1.18)
elif os.path.isdir(support.TESTFN):[](#l1.19)
result = 'd'[](#l1.20)
else:[](#l1.21)
result = None[](#l1.22)
return result[](#l1.23)
- def restore_support_TESTFN(self, saved_value):
if saved_value is None:[](#l1.25)
if os.path.isfile(support.TESTFN):[](#l1.26)
os.unlink(support.TESTFN)[](#l1.27)
elif os.path.isdir(support.TESTFN):[](#l1.28)
shutil.rmtree(support.TESTFN)[](#l1.29)
- def get_files(self):
return sorted(fn + ('/' if os.path.isdir(fn) else '')[](#l1.31)
for fn in os.listdir())[](#l1.32)
- def restore_files(self, saved_value):
fn = support.TESTFN[](#l1.34)
if fn not in saved_value and (fn + '/') not in saved_value:[](#l1.35)
if os.path.isfile(fn):[](#l1.36)
support.unlink(fn)[](#l1.37)
elif os.path.isdir(fn):[](#l1.38)
support.rmtree(fn)[](#l1.39)
lc = [getattr(locale, lc) for lc in dir(locale) if lc.startswith('LC')]
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -176,6 +176,9 @@ Build Tests ----- +- Issue #22390: test.regrtest now emits a warning if temporary files or