[Python-Dev] Tests failing on Windows with TESTFN
On Sun, Jul 29, 2018 at 3:13 AM Tim Golden <mail at timgolden.me.uk> wrote:
> For an example:
Thank you! After inspecting all the errors, it does seem that they
are ALL caused by "bare" os.unlink/rmdir calls. So it seems that a
massive undertaking of ferreting out these locations and replacing
them with their support equivalents would be needed to have a passing
test suite for you.
Unfortunately, test_mailbox is failing due to the same fate, but
within the stdlib itself. The fix for that will probably need to be a
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index 056251d..23662f2 100644
@@ -701,8 +701,10 @@ class _singlefileMailbox(Mailbox):
+ temp_name = _create_temporary_name(self._path)
+ os.rename(self._path, temp_name)
self._file = open(self._path, 'rb+')
self._toc = new_toc
self._pending = False
@@ -2112,11 +2114,14 @@ def _create_carefully(path):
+ """Create a temp filename based on path."""
+ return '%s.%s.%s.%s' % (path, int(time.time()), socket.gethostname(),
"""Create a temp file based on path and open for reading and writing."""
- return _create_carefully('%s.%s.%s.%s' % (path, int(time.time()),
+ return _create_carefully(_create_temporary_name(path))
"""Ensure changes to file f are physically on disk."""