Commit f2b36251 authored by Victor Stinner's avatar Victor Stinner

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).
parent 61761205
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment