From 629ef0fb9cad6ac340d3be884af7b47fb393ae99 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Wed, 28 Apr 2021 08:28:15 -0700 Subject: [PATCH] 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 Co-authored-by: Victor Stinner --- Lib/test/test_logging.py | 2 +- Misc/NEWS.d/next/Tests/2021-04-28-13-21-52.bpo-43961.gNchls.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Tests/2021-04-28-13-21-52.bpo-43961.gNchls.rst diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 1760e241d824..8a3ffb5584fb 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 000000000000..e56572f51709 --- /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.