diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-06-30 23:25:47 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-06-30 23:25:47 +0200 |
commit | d71a7e2007cc36fc17bf8b8ab01e84fe879538b2 (patch) | |
tree | d2aab56b82d6c0095fb6d9fda2ab48dad048ae24 /Lib/test/test_unicode_file.py | |
parent | 2af139ace436764098587945f48fb7e74636439b (diff) | |
download | cpython-d71a7e2007cc36fc17bf8b8ab01e84fe879538b2.tar.gz |
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/test/test_unicode_file.py')
-rw-r--r-- | Lib/test/test_unicode_file.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/test/test_unicode_file.py b/Lib/test/test_unicode_file.py index 6c2011ace8..68bd658a75 100644 --- a/Lib/test/test_unicode_file.py +++ b/Lib/test/test_unicode_file.py @@ -6,7 +6,7 @@ import unicodedata import unittest from test.support import (run_unittest, rmtree, - TESTFN_ENCODING, TESTFN_UNICODE, TESTFN_UNENCODABLE) + TESTFN_ENCODING, TESTFN_UNICODE, TESTFN_UNENCODABLE, create_empty_file) if not os.path.supports_unicode_filenames: try: @@ -99,8 +99,7 @@ class TestUnicodeFiles(unittest.TestCase): # top-level 'test' functions would be if they could take params def _test_single(self, filename): remove_if_exists(filename) - f = open(filename, "w") - f.close() + create_empty_file(filename) try: self._do_single(filename) finally: |