From 8121cfb2d32fa231ad9e3d51cc90f1efd10dae07 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 b19f13c0..6a49091a 100644 --- a/tests/sync/test_hg.py +++ b/tests/sync/test_hg.py @@ -22,14 +22,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 95dda539a0b0ae2a8d3a4a514fa57d987491f98c 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 131688ff..ec829974 100644 --- a/src/libvcs/pytest_plugin.py +++ b/src/libvcs/pytest_plugin.py @@ -103,16 +103,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")