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_glob.py b/Lib/test/test_glob.py
index 1560a6b..6ee08db 100644
--- a/Lib/test/test_glob.py
+++ b/Lib/test/test_glob.py
@@ -1,5 +1,6 @@
import unittest
-from test.support import run_unittest, TESTFN, skip_unless_symlink, can_symlink
+from test.support import (run_unittest, TESTFN, skip_unless_symlink,
+ can_symlink, create_empty_file)
import glob
import os
import shutil
@@ -14,8 +15,7 @@
base, file = os.path.split(filename)
if not os.path.exists(base):
os.makedirs(base)
- f = open(filename, 'w')
- f.close()
+ create_empty_file(filename)
def setUp(self):
self.tempdir = TESTFN+"_dir"