Skip to content

Commit

Permalink
Mark some cygpath tests xfail
Browse files Browse the repository at this point in the history
Two of the groups of cygpath tests in test_util.py generate tests
that fail on Cygwin. There is no easy way to still run, but xfail,
just the specific tests that fail, because the groups of tests are
generated with `@ddt` parameterization, but neither the unittest
nor pytest xfail mechanisms interact with that. If
`@pytest.mark.parametrized` were used, this could be done, but
that does not work on methods of test classes that derive from
unittest.TestCase, including those in this project that indirectly
derive from TestBase, which cannot be removed with overhauling many
tests, due to fixtures it provides such as rorepo.

So this marks too many tests as xfail, but in doing so allows test
runs to pass while still exercising and showing status on all the
tests, allowing result changes to be observed easily.
  • Loading branch information
EliahKagan committed Sep 17, 2023
1 parent 8d44365 commit 1b319e0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from datetime import datetime

import ddt
import pytest

from git.cmd import dashify
from git.compat import is_win
Expand Down Expand Up @@ -84,13 +85,21 @@ def setup(self):
"array": [42],
}

@pytest.mark.xfail(
reason="Many return paths prefixed /proc/cygdrive instead.",
raises=AssertionError,
)
@skipUnless(sys.platform == "cygwin", "Paths specifically for Cygwin.")
@ddt.idata(_norm_cygpath_pairs + _unc_cygpath_pairs)
def test_cygpath_ok(self, case):
wpath, cpath = case
cwpath = cygpath(wpath)
self.assertEqual(cwpath, cpath, wpath)

@pytest.mark.xfail(
reason=r'2nd example r".\bar" -> "bar" fails, returns "./bar"',
raises=AssertionError,
)
@skipUnless(sys.platform == "cygwin", "Paths specifically for Cygwin.")
@ddt.data(
(r"./bar", "bar"),
Expand Down

0 comments on commit 1b319e0

Please sign in to comment.