]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43961: Fix test_logging.test_namer_rotator_inheritance() (GH-25684) (GH-25688)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 28 Apr 2021 15:28:15 +0000 (08:28 -0700)
committerGitHub <noreply@github.com>
Wed, 28 Apr 2021 15:28:15 +0000 (17:28 +0200)
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>
Lib/test/test_logging.py
Misc/NEWS.d/next/Tests/2021-04-28-13-21-52.bpo-43961.gNchls.rst [new file with mode: 0644]

index 1760e241d824c61ceffc829bde6417195b77ffcd..8a3ffb5584fb824203796bb92face0735fac3d1e 100644 (file)
@@ -5102,7 +5102,7 @@ class RotatingFileHandlerTest(BaseFileTest):
 
             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 (file)
index 0000000..e56572f
--- /dev/null
@@ -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.