[Python-checkins] cpython (merge 3.4 -> default): Issue #22390: test.regrtest now emits a warning if temporary files or
serhiy.storchaka
python-checkins at python.org
Mon Mar 30 00:31:20 CEST 2015
https://hg.python.org/cpython/rev/bed806c9eb4c
changeset: 95255:bed806c9eb4c
parent: 95252:4d5826fa77a1
parent: 95254:05e6bab4db8f
user: Serhiy Storchaka <storchaka at gmail.com>
date: Mon Mar 30 01:30:22 2015 +0300
summary:
Issue #22390: test.regrtest now emits a warning if temporary files or
directories are left after running a test.
files:
Lib/test/regrtest.py | 26 +++++++++++---------------
Misc/NEWS | 3 +++
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -1031,7 +1031,7 @@
# to a thread, so check processes first.
'multiprocessing.process._dangling', 'threading._dangling',
'sysconfig._CONFIG_VARS', 'sysconfig._INSTALL_SCHEMES',
- 'support.TESTFN', 'locale', 'warnings.showwarning',
+ 'files', 'locale', 'warnings.showwarning',
)
def get_sys_argv(self):
@@ -1187,20 +1187,16 @@
sysconfig._INSTALL_SCHEMES.clear()
sysconfig._INSTALL_SCHEMES.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 get_files(self):
+ return sorted(fn + ('/' if os.path.isdir(fn) else '')
+ for fn in os.listdir())
+ def restore_files(self, saved_value):
+ fn = support.TESTFN
+ if fn not in saved_value and (fn + '/') not in saved_value:
+ if os.path.isfile(fn):
+ support.unlink(fn)
+ elif os.path.isdir(fn):
+ support.rmtree(fn)
_lc = [getattr(locale, lc) for lc in dir(locale)
if lc.startswith('LC_')]
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -176,6 +176,9 @@
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 #22289: Prevent test_urllib2net failures due to ftp connection timeout.
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list