Skip to content

Commit

Permalink
Mark TestSubmodule.test_rename xfail on Windows
Browse files Browse the repository at this point in the history
The test fails when attempting to evaluate the expression:

    sm.move(new_path).name

as part of the assertion:

    assert sm.move(new_path).name == new_path

But it is the call to sm.move that fails, not the assertion itself.
The condition is never evaluated, because the subexpression raises
PermissionError. Details are in the xfail reason string.

This test_submodule.TestSubmodule.test_rename method should not be
confused with test_config.TestBase.test_rename, which passes on all
platforms.

On CI this has XPASS status on Python 3.7 and possibly some other
versions. This should be investigated and, if possible, the xfail
markings should be made precise. (When working on this change
before a rebase, I had thought only 3.7 xpassed, and that the XPASS
was only on CI, never locally. However, I am unable to reproduce
that or find CI logs of it, so some of these observations may have
been mistaken and/or or specific to a narrow environment.)
  • Loading branch information
EliahKagan committed Nov 24, 2023
1 parent f72e282 commit 42a3d74
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/test_submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,17 @@ def test_remove_norefs(self, rwdir):
sm.remove()
assert not sm.exists()

@pytest.mark.xfail(
os.name == "nt",
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'"
),
raises=PermissionError,
)
@with_rw_directory
def test_rename(self, rwdir):
parent = git.Repo.init(osp.join(rwdir, "parent"))
Expand Down

0 comments on commit 42a3d74

Please sign in to comment.