Skip to content

Commit 8b4a7ea

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. Surprisingly, on CI, this has XPASS status on Python 3.7. Somehow the test is passing, but only on CI, and only on 3.7. This should be investigated. The xfail condition could be adjusted, but locally on Windows I find it to fail, even on 3.7.9 (the exact version the CI test runner reports it is using for Python 3.7). If the xfail condition cannot be made more accurate, a comment could be added.
1 parent 4bc7144 commit 8b4a7ea

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)