summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests
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/distutils/tests
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/distutils/tests')
-rw-r--r--Lib/distutils/tests/test_build_py.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/distutils/tests/test_build_py.py b/Lib/distutils/tests/test_build_py.py
index 4e46339..c7c36f3 100644
--- a/Lib/distutils/tests/test_build_py.py
+++ b/Lib/distutils/tests/test_build_py.py
@@ -10,7 +10,7 @@ from distutils.core import Distribution
from distutils.errors import DistutilsFileError
from distutils.tests import support
-from test.support import run_unittest
+from test.support import run_unittest, create_empty_file
class BuildPyTestCase(support.TempdirManager,
@@ -71,11 +71,11 @@ class BuildPyTestCase(support.TempdirManager,
# create the distribution files.
sources = self.mkdtemp()
- open(os.path.join(sources, "__init__.py"), "w").close()
+ create_empty_file(os.path.join(sources, "__init__.py"))
testdir = os.path.join(sources, "doc")
os.mkdir(testdir)
- open(os.path.join(testdir, "testfile"), "w").close()
+ create_empty_file(os.path.join(testdir, "testfile"))
os.chdir(sources)
old_stdout = sys.stdout