Skip to content

Commit 95dda53

Browse files
committed
refactor: pytest_ignore_collect to return False, which after needle match
1 parent 8121cfb commit 95dda53

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/libvcs/pytest_plugin.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,17 @@ def __next__(self) -> str:
103103

104104
def pytest_ignore_collect(collection_path: pathlib.Path, config: pytest.Config) -> bool:
105105
"""Skip tests if VCS binaries are missing."""
106-
if not shutil.which("svn") and any(
106+
if any(
107107
needle in str(collection_path) for needle in ["svn", "subversion"]
108-
):
108+
) and not shutil.which("svn"):
109109
return True
110-
if not shutil.which("git") and "git" in str(collection_path):
110+
if "git" in str(collection_path) and not shutil.which("git"):
111111
return True
112-
return bool(
113-
not shutil.which("hg")
114-
and any(needle in str(collection_path) for needle in ["hg", "mercurial"]),
115-
)
112+
if any( # NOQA: SIM103
113+
needle in str(collection_path) for needle in ["hg", "mercurial"]
114+
) and not shutil.which("hg"):
115+
return True
116+
return False
116117

117118

118119
@pytest.fixture(scope="session")

0 commit comments

Comments
 (0)