mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +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
|
|
@ -902,8 +902,7 @@ class TestMaildir(TestMailbox):
|
|||
# Now, write something into cur and remove it. This changes
|
||||
# the mtime and should cause a re-read.
|
||||
filename = os.path.join(self._path, 'cur', 'stray-file')
|
||||
f = open(filename, 'w')
|
||||
f.close()
|
||||
support.create_empty_file(filename)
|
||||
os.unlink(filename)
|
||||
self._box._refresh()
|
||||
self.assertTrue(refreshed())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue