Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf664a0b

Browse files
committed
Add xfail marks to hook tests for WinBashStatus.Absent
Precise xfail marks were added to commit hook tests in#1745, butin a few tests I didn't get it right for WinBashStatus.Absent. Thatis, on a Windows system that has no bash.exe at all:- More of the tests are unable to pass than have xfail marks.- One of the tests, test_commit_msg_hook_success, which does have an xfail mark for that, wrongly combines it with the xfail mark for WinBashStatus.Wsl. That test is the only one where the WSL bash.exe, even when a working WSL distribution is installed, is unable to pass. But using a single mark there is wrong, in part because the "reason" is not correct for both, but even more so because the exceptions they raise are different: AssertionError is raised when the WSL bash.exe is used in that test, but when bash.exe is altogether absent, HookExecutionError is raised.This fixes that by adding xfail marks for WinBashStatus.Absentwhere missing, and splitting test_commit_msg_hook_success's xfailmark that unsuccessfully tried to cover two conditions into twoseparate marks, each of which gives a correct reason and exception.This commit also rewords the xfail reason given for WslNoDistro,which was somewhat unclear and potentially ambiguous, to make itclearer.
1 parent4023f28 commitf664a0b

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

‎test/test_index.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -991,9 +991,14 @@ class Mocked:
991991
rel=index._to_relative_path(path)
992992
self.assertEqual(rel,os.path.relpath(path,root))
993993

994+
@pytest.mark.xfail(
995+
type(_win_bash_status)isWinBashStatus.Absent,
996+
reason="Can't run a hook on Windows without bash.exe.",
997+
rasies=HookExecutionError,
998+
)
994999
@pytest.mark.xfail(
9951000
type(_win_bash_status)isWinBashStatus.WslNoDistro,
996-
reason="Currently uses the bash.exefor WSL even with no WSL distro installed",
1001+
reason="Currently uses the bash.exeof WSL, even with no WSL distro installed",
9971002
raises=HookExecutionError,
9981003
)
9991004
@with_rw_repo("HEAD",bare=True)
@@ -1004,7 +1009,7 @@ def test_pre_commit_hook_success(self, rw_repo):
10041009

10051010
@pytest.mark.xfail(
10061011
type(_win_bash_status)isWinBashStatus.WslNoDistro,
1007-
reason="Currently uses the bash.exefor WSL even with no WSL distro installed",
1012+
reason="Currently uses the bash.exeof WSL, even with no WSL distro installed",
10081013
raises=AssertionError,
10091014
)
10101015
@with_rw_repo("HEAD",bare=True)
@@ -1030,13 +1035,18 @@ def test_pre_commit_hook_fail(self, rw_repo):
10301035
raiseAssertionError("Should have caught a HookExecutionError")
10311036

10321037
@pytest.mark.xfail(
1033-
type(_win_bash_status)in {WinBashStatus.Absent,WinBashStatus.Wsl},
1038+
type(_win_bash_status)isWinBashStatus.Absent,
1039+
reason="Can't run a hook on Windows without bash.exe.",
1040+
rasies=HookExecutionError,
1041+
)
1042+
@pytest.mark.xfail(
1043+
type(_win_bash_status)isWinBashStatus.Wsl,
10341044
reason="Specifically seems to fail on WSL bash (in spite of #1399)",
10351045
raises=AssertionError,
10361046
)
10371047
@pytest.mark.xfail(
10381048
type(_win_bash_status)isWinBashStatus.WslNoDistro,
1039-
reason="Currently uses the bash.exefor WSL even with no WSL distro installed",
1049+
reason="Currently uses the bash.exeof WSL, even with no WSL distro installed",
10401050
raises=HookExecutionError,
10411051
)
10421052
@with_rw_repo("HEAD",bare=True)
@@ -1054,7 +1064,7 @@ def test_commit_msg_hook_success(self, rw_repo):
10541064

10551065
@pytest.mark.xfail(
10561066
type(_win_bash_status)isWinBashStatus.WslNoDistro,
1057-
reason="Currently uses the bash.exefor WSL even with no WSL distro installed",
1067+
reason="Currently uses the bash.exeof WSL, even with no WSL distro installed",
10581068
raises=AssertionError,
10591069
)
10601070
@with_rw_repo("HEAD",bare=True)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp