]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43961: Fix test_logging.test_namer_rotator_inheritance() (GH-25684)
authorVictor Stinner <vstinner@python.org>
Wed, 28 Apr 2021 13:47:10 +0000 (15:47 +0200)
committerGitHub <noreply@github.com>
Wed, 28 Apr 2021 13:47:10 +0000 (15:47 +0200)
Fix test_logging.test_namer_rotator_inheritance() on Windows: use
os.replace() rather than os.rename().

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 bb31e29ca7691180abfc75cd8da7ec5c8bbb193c..1d061e4993ce0e159e76b65bccf5ea5821ff43b9 100644 (file)
@@ -5219,7 +5219,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, encoding="utf-8", 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.