From 0b7ee17849a48ca691eaa3cc5d3eb81a4e6592b7 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Fri, 24 Nov 2023 20:14:35 -0500 Subject: [PATCH] Refine TestSubmodule.test_rename xfail condition This further improves the condition that was corrected in 82c361e. Testing on Python 3.13.0 alpha 2 shows the same failure as on 3.12 (that I'm at least right now consistently unable to produce on any lower versions). In addition, on both versions of CPython on Windows, the failure seems to consistently resolve if two gc.collect() are placed just above the code that calls sm.move(). A single call is consistently insufficient. I haven't included any such calls in this commit, since the focus here is on fixing xfail markings, and becuse such a change may benefit from being evaluated separately and may merit further accompanying changes. But that this behavior is exhibited on both 3.12 and the 3.13 alpha further supports removing the upper bound on the xfail marking. --- test/test_submodule.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_submodule.py b/test/test_submodule.py index 1e39924dd..7fbccf831 100644 --- a/test/test_submodule.py +++ b/test/test_submodule.py @@ -950,14 +950,14 @@ def test_remove_norefs(self, rwdir): assert not sm.exists() @pytest.mark.xfail( - os.name == "nt" and (3, 12) <= sys.version_info < (3, 13), + os.name == "nt" and sys.version_info >= (3, 12), reason=( "The sm.move call fails. Submodule.move calls os.renames, which raises:\n" "PermissionError: [WinError 32] " "The process cannot access the file because it is being used by another process: " R"'C:\Users\ek\AppData\Local\Temp\test_renamekkbznwjp\parent\mymodules\myname' " R"-> 'C:\Users\ek\AppData\Local\Temp\test_renamekkbznwjp\parent\renamed\myname'" - "\nThis resembles other Windows errors, but seems only to affect Python 3.12 somehow." + "\nThis resembles other Windows errors, but only occurs starting in Python 3.12." ), raises=PermissionError, )