[Python-checkins] r76217 - in python/trunk: Lib/test/test_tarfile.py Misc/NEWS

antoine.pitrou python-checkins at python.org
Wed Nov 11 21:55:08 CET 2009


Author: antoine.pitrou
Date: Wed Nov 11 21:55:07 2009
New Revision: 76217

Log:
Issue #7295: Do not use a hardcoded file name in test_tarfile.



Modified:
   python/trunk/Lib/test/test_tarfile.py
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/test/test_tarfile.py
==============================================================================
--- python/trunk/Lib/test/test_tarfile.py	(original)
+++ python/trunk/Lib/test/test_tarfile.py	Wed Nov 11 21:55:07 2009
@@ -27,11 +27,8 @@
 def md5sum(data):
     return md5(data).hexdigest()
 
-def path(path):
-    return test_support.findfile(path)
-
-TEMPDIR = os.path.join(tempfile.gettempdir(), "test_tarfile_tmp")
-tarname = path("testtar.tar")
+TEMPDIR = os.path.abspath(test_support.TESTFN)
+tarname = test_support.findfile("testtar.tar")
 gzipname = os.path.join(TEMPDIR, "testtar.tar.gz")
 bz2name = os.path.join(TEMPDIR, "testtar.tar.bz2")
 tmpname = os.path.join(TEMPDIR, "tmp.tar")
@@ -1263,8 +1260,7 @@
 
 
 def test_main():
-    if not os.path.exists(TEMPDIR):
-        os.mkdir(TEMPDIR)
+    os.makedirs(TEMPDIR)
 
     tests = [
         UstarReadTest,

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Wed Nov 11 21:55:07 2009
@@ -1559,6 +1559,8 @@
 Tests
 -----
 
+- Issue #7295: Do not use a hardcoded file name in test_tarfile.
+
 - Issue #7270: Add some dedicated unit tests for multi-thread synchronization
   primitives such as Lock, RLock, Condition, Event and Semaphore.
 


More information about the Python-checkins mailing list