diff --git a/test/test_util.py b/test/test_util.py index f5d716d4c..39dbe5e56 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -211,6 +211,11 @@ def test_env_vars_for_windows_tests(self, name, env_var_value, expected_truth_va assert actual_parsed_value is expected_truth_value +def _xfail_param(*values, **xfail_kwargs): + """Build a pytest.mark.parametrize parameter that carries an xfail mark.""" + return pytest.param(*values, marks=pytest.mark.xfail(**xfail_kwargs)) + + @pytest.mark.skipif(sys.platform != "cygwin", reason="Paths specifically for Cygwin.") class TestCygpath: """Tests for :func:`git.util.cygpath` and :func:`git.util.decygpath`.""" @@ -246,15 +251,11 @@ def test_cygpath_ok(self, wpath, cpath): cwpath = cygpath(wpath) assert cwpath == cpath, wpath - @pytest.mark.xfail( - reason=R'2nd example r".\bar" -> "bar" fails, returns "./bar"', - raises=AssertionError, - ) @pytest.mark.parametrize( "wpath, cpath", [ (R"./bar", "bar"), - (R".\bar", "bar"), # FIXME: Mark only this one xfail (or fix it). + _xfail_param(R".\bar", "bar", reason=R'Returns: "./bar"', raises=AssertionError), (R"../bar", "../bar"), (R"..\bar", "../bar"), (R"../bar/.\foo/../chu", "../bar/chu"),