Issue #22390: test.regrtest now emits a warning if temporary files or

directories are left after running a test.
This commit is contained in:
Serhiy Storchaka 2015-03-30 01:30:22 +03:00
commit 10915aa85c
2 changed files with 14 additions and 15 deletions

View File

@ -1031,7 +1031,7 @@ class saved_test_environment:
# to a thread, so check processes first. # to a thread, so check processes first.
'multiprocessing.process._dangling', 'threading._dangling', 'multiprocessing.process._dangling', 'threading._dangling',
'sysconfig._CONFIG_VARS', 'sysconfig._INSTALL_SCHEMES', 'sysconfig._CONFIG_VARS', 'sysconfig._INSTALL_SCHEMES',
'support.TESTFN', 'locale', 'warnings.showwarning', 'files', 'locale', 'warnings.showwarning',
) )
def get_sys_argv(self): def get_sys_argv(self):
@ -1187,20 +1187,16 @@ class saved_test_environment:
sysconfig._INSTALL_SCHEMES.clear() sysconfig._INSTALL_SCHEMES.clear()
sysconfig._INSTALL_SCHEMES.update(saved[2]) sysconfig._INSTALL_SCHEMES.update(saved[2])
def get_support_TESTFN(self): def get_files(self):
if os.path.isfile(support.TESTFN): return sorted(fn + ('/' if os.path.isdir(fn) else '')
result = 'f' for fn in os.listdir())
elif os.path.isdir(support.TESTFN): def restore_files(self, saved_value):
result = 'd' fn = support.TESTFN
else: if fn not in saved_value and (fn + '/') not in saved_value:
result = None if os.path.isfile(fn):
return result support.unlink(fn)
def restore_support_TESTFN(self, saved_value): elif os.path.isdir(fn):
if saved_value is None: support.rmtree(fn)
if os.path.isfile(support.TESTFN):
os.unlink(support.TESTFN)
elif os.path.isdir(support.TESTFN):
shutil.rmtree(support.TESTFN)
_lc = [getattr(locale, lc) for lc in dir(locale) _lc = [getattr(locale, lc) for lc in dir(locale)
if lc.startswith('LC_')] if lc.startswith('LC_')]

View File

@ -176,6 +176,9 @@ Build
Tests Tests
----- -----
- Issue #22390: test.regrtest now emits a warning if temporary files or
directories are left after running a test.
- Issue #23583: Added tests for standard IO streams in IDLE. - Issue #23583: Added tests for standard IO streams in IDLE.
- Issue #22289: Prevent test_urllib2net failures due to ftp connection timeout. - Issue #22289: Prevent test_urllib2net failures due to ftp connection timeout.