[Python-Dev] Tests failing on Windows with TESTFN
Jeremy Kloth
jeremy.kloth at gmail.com
Sun Jul 29 11:40:45 EDT 2018
More information about the Python-Dev mailing list
Sun Jul 29 11:40:45 EDT 2018
- Previous message (by thread): [Python-Dev] Tests failing on Windows with TESTFN
- Next message (by thread): [Python-Dev] Tests failing on Windows with TESTFN
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, Jul 29, 2018 at 9:34 AM Tim Golden <mail at timgolden.me.uk> wrote: > For test_mailbox I've experimentally implemented a hybrid tempfile / > local directory solution. ie I've created a new file on each run, but > only within the python_<pid> folder which already exists. As long as the > directory cleans up there should be no leftovers. That's certainly > helped although my re-run harness has provoked at least one error. As Eryk noted, the fix for mailbox.py (yes, the stdlib needs fixing in this case) is quite simple: diff --git a/Lib/mailbox.py b/Lib/mailbox.py index 056251d..eb85df1 100644 --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -701,8 +701,7 @@ class _singlefileMailbox(Mailbox): try: os.rename(new_file.name, self._path) except FileExistsError: - os.remove(self._path) - os.rename(new_file.name, self._path) + os.replace(new_file.name, self._path) self._file = open(self._path, 'rb+') self._toc = new_toc self._pending = False -- Jeremy Kloth
- Previous message (by thread): [Python-Dev] Tests failing on Windows with TESTFN
- Next message (by thread): [Python-Dev] Tests failing on Windows with TESTFN
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list