Skip to content

Commit

Permalink
refactor: pytest_ignore_collect to return False, which after needle…
Browse files Browse the repository at this point in the history
… match
  • Loading branch information
tony committed Dec 7, 2024
1 parent 11df64e commit 2d78366
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/libvcs/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,17 @@ def __next__(self) -> str:

def pytest_ignore_collect(collection_path: pathlib.Path, config: pytest.Config) -> bool:
"""Skip tests if VCS binaries are missing."""
if not shutil.which("svn") and any(
if any(
needle in str(collection_path) for needle in ["svn", "subversion"]
):
) and not shutil.which("svn"):
return True
if not shutil.which("git") and "git" in str(collection_path):
if "git" in str(collection_path) and not shutil.which("git"):
return True
return bool(
not shutil.which("hg")
and any(needle in str(collection_path) for needle in ["hg", "mercurial"]),
)
if any( # NOQA: SIM103
needle in str(collection_path) for needle in ["hg", "mercurial"]
) and not shutil.which("hg"):
return True
return False


@pytest.fixture(scope="session")
Expand Down

0 comments on commit 2d78366

Please sign in to comment.