Skip to content

Commit 9c22eeb

Browse files
committed
pytest_plugin(fix[skip_if_svn_missing]): Require svnadmin too
why: The svn fixtures build repositories with `svnadmin`, and _skip_if_svn_missing() treats svn as available only when both the svn client and svnadmin are present. The public skip_if_svn_missing mark and the pytest_ignore_collect hook checked the svn client alone, so on a host with svn but not svnadmin they disagreed with the fixtures: a mark-decorated test would run, and svn doctest modules would be collected while their create_svn_remote_repo namespace helper -- which also requires svnadmin -- was withheld, erroring with NameError instead of skipping. Make every svn-availability check require svnadmin. what: - Add the svnadmin check to the skip_if_svn_missing mark condition - Require svnadmin in pytest_ignore_collect so svn modules are ignored (not collected) when only the svn client is present
1 parent c83eb53 commit 9c22eeb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/libvcs/pytest_plugin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def __init__(self, attempts: int, *args: object) -> None:
3434
reason="git is not available",
3535
)
3636
skip_if_svn_missing = pytest.mark.skipif(
37-
not shutil.which("svn"),
38-
reason="svn is not available",
37+
not shutil.which("svn") or not shutil.which("svnadmin"),
38+
reason="svn or svnadmin is not available",
3939
)
4040
skip_if_hg_missing = pytest.mark.skipif(
4141
not shutil.which("hg"),
@@ -52,7 +52,7 @@ def _skip_if_git_missing() -> None:
5252
def _skip_if_svn_missing() -> None:
5353
"""Skip the calling fixture when ``svn`` or ``svnadmin`` is unavailable."""
5454
if not shutil.which("svn") or not shutil.which("svnadmin"):
55-
pytest.skip(reason="svn is not available")
55+
pytest.skip(reason="svn or svnadmin is not available")
5656

5757

5858
def _skip_if_hg_missing() -> None:
@@ -121,7 +121,7 @@ def __next__(self) -> str:
121121

122122
def pytest_ignore_collect(collection_path: pathlib.Path, config: pytest.Config) -> bool:
123123
"""Skip tests if VCS binaries are missing."""
124-
if not shutil.which("svn") and any(
124+
if (not shutil.which("svn") or not shutil.which("svnadmin")) and any(
125125
needle in str(collection_path) for needle in ["svn", "subversion"]
126126
):
127127
return True

0 commit comments

Comments
 (0)