bpo-43961: Fix test_logging.test_namer_rotator_inheritance() (GH-25684) (GH-25688)
https://github.com/python/cpython/commit/629ef0fb9cad6ac340d3be884af7b47fb39... commit: 629ef0fb9cad6ac340d3be884af7b47fb393ae99 branch: 3.9 author: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> committer: vstinner <vstinner@python.org> date: 2021-04-28T17:28:15+02:00 summary: bpo-43961: Fix test_logging.test_namer_rotator_inheritance() (GH-25684) (GH-25688) Fix test_logging.test_namer_rotator_inheritance() on Windows: use os.replace() rather than os.rename(). (cherry picked from commit fe52eb62191e640e720d184a9a1a04e965b8a062) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Victor Stinner <vstinner@python.org> files: A Misc/NEWS.d/next/Tests/2021-04-28-13-21-52.bpo-43961.gNchls.rst M Lib/test/test_logging.py diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 1760e241d824c6..8a3ffb5584fb82 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -5102,7 +5102,7 @@ def namer(self, name): def rotator(self, source, dest): if os.path.exists(source): - os.rename(source, dest + ".rotated") + os.replace(source, dest + ".rotated") rh = HandlerWithNamerAndRotator( self.fn, backupCount=2, maxBytes=1) diff --git a/Misc/NEWS.d/next/Tests/2021-04-28-13-21-52.bpo-43961.gNchls.rst b/Misc/NEWS.d/next/Tests/2021-04-28-13-21-52.bpo-43961.gNchls.rst new file mode 100644 index 00000000000000..e56572f5170998 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2021-04-28-13-21-52.bpo-43961.gNchls.rst @@ -0,0 +1,2 @@ +Fix test_logging.test_namer_rotator_inheritance() on Windows: use +:func:`os.replace` rather than :func:`os.rename`. Patch by Victor Stinner.
participants (1)
-
vstinner