Skip to content

Commit

Permalink
Refine TestSubmodule.test_rename xfail condition
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
EliahKagan committed Nov 25, 2023
1 parent 0ae5dd1 commit 0b7ee17
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/test_submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down

0 comments on commit 0b7ee17

Please sign in to comment.