summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tarfile.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-06-30 21:25:47 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-06-30 21:25:47 (GMT)
commitbf816223dfe8f1d36a020b4bc02060b8d1ce7d26 (patch)
tree3651ee82210cb2110b6808a2545471cac321a22f /Lib/test/test_tarfile.py
parent61600cb0c357fcdca048cee586865a26417dbd70 (diff)
downloadcpython-bf816223dfe8f1d36a020b4bc02060b8d1ce7d26.zip
cpython-bf816223dfe8f1d36a020b4bc02060b8d1ce7d26.tar.gz
cpython-bf816223dfe8f1d36a020b4bc02060b8d1ce7d26.tar.bz2
Issue #12451: Add support.create_empty_file()
We don't need to create a temporary buffered binary or text file object just to create an empty file. Replace also os.fdopen(handle).close() by os.close(handle).
Diffstat (limited to 'Lib/test/test_tarfile.py')
-rw-r--r--Lib/test/test_tarfile.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index ddde01c..d65e1b5 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -893,7 +893,7 @@ class WriteTest(WriteTestBase):
try:
for name in ("foo", "bar", "baz"):
name = os.path.join(tempdir, name)
- open(name, "wb").close()
+ support.create_empty_file(name)
exclude = os.path.isfile
@@ -920,7 +920,7 @@ class WriteTest(WriteTestBase):
try:
for name in ("foo", "bar", "baz"):
name = os.path.join(tempdir, name)
- open(name, "wb").close()
+ support.create_empty_file(name)
def filter(tarinfo):
if os.path.basename(tarinfo.name) == "bar":
@@ -959,7 +959,7 @@ class WriteTest(WriteTestBase):
# and compare the stored name with the original.
foo = os.path.join(TEMPDIR, "foo")
if not dir:
- open(foo, "w").close()
+ support.create_empty_file(foo)
else:
os.mkdir(foo)