Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 487bc8a

Browse files
committed
Start making TestCygpath xfail markings granular
This marks only the one really expected failure case in in test_cygpath_norm_ok as xfail, preventing the others from giving "XPASS" results each time the tests are run.
1 parent 1dccb8e commit 487bc8a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/test_util.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ def test_env_vars_for_windows_tests(self, name, env_var_value, expected_truth_va
211211
assert actual_parsed_value is expected_truth_value
212212

213213

214+
def _xfail_param(*values, **xfail_kwargs):
215+
"""Build a pytest.mark.parametrize parameter that carries an xfail mark."""
216+
return pytest.param(*values, marks=pytest.mark.xfail(**xfail_kwargs))
217+
218+
214219
@pytest.mark.skipif(sys.platform != "cygwin", reason="Paths specifically for Cygwin.")
215220
class TestCygpath:
216221
"""Tests for :func:`git.util.cygpath` and :func:`git.util.decygpath`."""
@@ -246,15 +251,11 @@ def test_cygpath_ok(self, wpath, cpath):
246251
cwpath = cygpath(wpath)
247252
assert cwpath == cpath, wpath
248253

249-
@pytest.mark.xfail(
250-
reason=R'2nd example r".\bar" -> "bar" fails, returns "./bar"',
251-
raises=AssertionError,
252-
)
253254
@pytest.mark.parametrize(
254255
"wpath, cpath",
255256
[
256257
(R"./bar", "bar"),
257-
(R".\bar", "bar"), # FIXME: Mark only this one xfail (or fix it).
258+
_xfail_param(R".\bar", "bar", reason=R'Returns: "./bar"', raises=AssertionError),
258259
(R"../bar", "../bar"),
259260
(R"..\bar", "../bar"),
260261
(R"../bar/.\foo/../chu", "../bar/chu"),

0 commit comments

Comments
 (0)