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).
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
index 83fcf22..3041218 100644
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -324,8 +324,7 @@
shutil.rmtree('pep3147')
self.addCleanup(cleanup)
# Touch the __init__.py file.
- with open('pep3147/__init__.py', 'w'):
- pass
+ support.create_empty_file('pep3147/__init__.py')
m = __import__('pep3147')
# Ensure we load the pyc file.
support.forget('pep3147')