summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2012-03-06 20:07:15 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2012-03-06 20:07:15 (GMT)
commitda563bfa4800688d0a2a771b8335a184738c8df2 (patch)
tree1f93f8e5ff2819994e2ae2727513566f5e867545 /Lib/test/regrtest.py
parent1bf6bb6c37325e50bc7070453a5240cda85d3149 (diff)
downloadcpython-da563bfa4800688d0a2a771b8335a184738c8df2.zip
cpython-da563bfa4800688d0a2a771b8335a184738c8df2.tar.gz
cpython-da563bfa4800688d0a2a771b8335a184738c8df2.tar.bz2
Closes #14158: We now track test_support.TESTFN cleanup, and test_mailbox uses shutil.rmtree for simpler code.
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-xLib/test/regrtest.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 5044ce4..75a9bec 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -758,7 +758,9 @@ class saved_test_environment:
# the corresponding method names.
resources = ('sys.argv', 'cwd', 'sys.stdin', 'sys.stdout', 'sys.stderr',
- 'os.environ', 'sys.path', 'asyncore.socket_map')
+ 'os.environ', 'sys.path', 'asyncore.socket_map',
+ 'test_support.TESTFN',
+ )
def get_sys_argv(self):
return id(sys.argv), sys.argv, sys.argv[:]
@@ -809,6 +811,21 @@ class saved_test_environment:
asyncore.close_all(ignore_all=True)
asyncore.socket_map.update(saved_map)
+ def get_test_support_TESTFN(self):
+ if os.path.isfile(test_support.TESTFN):
+ result = 'f'
+ elif os.path.isdir(test_support.TESTFN):
+ result = 'd'
+ else:
+ result = None
+ return result
+ def restore_test_support_TESTFN(self, saved_value):
+ if saved_value is None:
+ if os.path.isfile(test_support.TESTFN):
+ os.unlink(test_support.TESTFN)
+ elif os.path.isdir(test_support.TESTFN):
+ shutil.rmtree(test_support.TESTFN)
+
def resource_info(self):
for name in self.resources:
method_suffix = name.replace('.', '_')