Skip to content

Commit 42a3d74

Browse files
committed
Mark TestSubmodule.test_rename xfail on Windows
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.)
1 parent f72e282 commit 42a3d74

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/test_submodule.py

+11
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,17 @@ def test_remove_norefs(self, rwdir):
949949
sm.remove()
950950
assert not sm.exists()
951951

952+
@pytest.mark.xfail(
953+
os.name == "nt",
954+
reason=(
955+
"The sm.move call fails. Submodule.move calls os.renames, which raises:\n"
956+
"PermissionError: [WinError 32] "
957+
"The process cannot access the file because it is being used by another process: "
958+
R"'C:\Users\ek\AppData\Local\Temp\test_renamekkbznwjp\parent\mymodules\myname' "
959+
R"-> 'C:\Users\ek\AppData\Local\Temp\test_renamekkbznwjp\parent\renamed\myname'"
960+
),
961+
raises=PermissionError,
962+
)
952963
@with_rw_directory
953964
def test_rename(self, rwdir):
954965
parent = git.Repo.init(osp.join(rwdir, "parent"))

0 commit comments

Comments
 (0)