mirror of
https://github.com/python/cpython.git
synced 2025-11-19 10:46:17 +00:00
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).
This commit is contained in:
parent
61600cb0c3
commit
bf816223df
17 changed files with 50 additions and 53 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue