diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index bb31e29ca76..1d061e4993c 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -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 index 00000000000..e56572f5170 --- /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.