From 78b091e9bfda9d1506ae7a9c053c5348336749c1 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Tue, 15 Oct 2024 06:32:23 -0500 Subject: [PATCH 1/2] test(sync[hg]) Remove unneeded autouse fixture --- tests/sync/test_hg.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/sync/test_hg.py b/tests/sync/test_hg.py index de643f81..87af043a 100644 --- a/tests/sync/test_hg.py +++ b/tests/sync/test_hg.py @@ -16,14 +16,6 @@ pytestmark = pytest.mark.skip(reason="hg is not available") -@pytest.fixture(autouse=True) -def set_hgconfig( - set_hgconfig: pathlib.Path, -) -> pathlib.Path: - """Set mercurial configuration.""" - return set_hgconfig - - def test_hg_sync( tmp_path: pathlib.Path, projects_path: pathlib.Path, From fb2067063c273663bf2b6ccba113e222380916e4 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 7 Dec 2024 16:34:20 -0600 Subject: [PATCH 2/2] refactor: pytest_ignore_collect to return False, `which` after needle match --- src/libvcs/pytest_plugin.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libvcs/pytest_plugin.py b/src/libvcs/pytest_plugin.py index 0e6e9710..889cdad9 100644 --- a/src/libvcs/pytest_plugin.py +++ b/src/libvcs/pytest_plugin.py @@ -108,16 +108,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")