]> granicus.if.org Git - python/commitdiff
Issue #7295: Do not use a hardcoded file name in test_tarfile.
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 11 Nov 2009 20:55:07 +0000 (20:55 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 11 Nov 2009 20:55:07 +0000 (20:55 +0000)
Lib/test/test_tarfile.py
Misc/NEWS

index 1240e1a97fcd5c7afd7bfc41997b7eb71b17cb82..74a8dac71364cf2175920d0353cdac4c8723938d 100644 (file)
@@ -27,11 +27,8 @@ except ImportError:
 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 @@ class Bz2PartialReadTest(unittest.TestCase):
 
 
 def test_main():
-    if not os.path.exists(TEMPDIR):
-        os.mkdir(TEMPDIR)
+    os.makedirs(TEMPDIR)
 
     tests = [
         UstarReadTest,
index e3638aaa80401e76593dcd83f5e8fc374a9b5968..cf1f54a3f04221051a89b05dbf37926cca5a0678 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -1559,6 +1559,8 @@ Extension Modules
 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.