summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2003-06-12 08:01:06 (GMT)
committerBrett Cannon <bcannon@gmail.com>2003-06-12 08:01:06 (GMT)
commit455ea53d0e7a21af210eef71644700b3979badce (patch)
tree94e7616654825e4f5918a701817047d0341c7931 /Lib/test
parenta4e5c4da4d9325b6858808f32e3aca4fa799c038 (diff)
downloadcpython-455ea53d0e7a21af210eef71644700b3979badce.zip
cpython-455ea53d0e7a21af210eef71644700b3979badce.tar.gz
cpython-455ea53d0e7a21af210eef71644700b3979badce.tar.bz2
Make creation of temporary file and directory more portable. Also made cleanup
code use proper functions to get paths. Changed the name of tar file that is searched for to be absolute (i.e., not use os.extsep) since filename is locked in based on name of file in CVS (testtar.tar). Closes bug #731403 .
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_tarfile.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index e259712..682d0d8 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -1,6 +1,7 @@
import sys
import os
import shutil
+import tempfile
import unittest
import tarfile
@@ -21,9 +22,9 @@ except ImportError:
def path(path):
return test_support.findfile(path)
-testtar = path("testtar" + os.extsep + "tar")
-tempdir = path("testtar" + os.extsep + "dir")
-tempname = path("testtar" + os.extsep + "tmp")
+testtar = path("testtar.tar")
+tempdir = os.path.join(tempfile.gettempdir(), "testtar" + os.extsep + "dir")
+tempname = test_support.TESTFN
membercount = 10
def tarname(comp=""):
@@ -265,10 +266,10 @@ def test_main():
os.remove(tarname("gz"))
if bz2:
os.remove(tarname("bz2"))
- if os.path.exists(tempdir):
- shutil.rmtree(tempdir)
- if os.path.exists(tempname):
- os.remove(tempname)
+ if os.path.exists(dirname()):
+ shutil.rmtree(dirname())
+ if os.path.exists(tmpname()):
+ os.remove(tmpname())
if __name__ == "__main__":
test_main()