Skip to content

Commit 2732199

Browse files
Merge pull request #426 from mgorny/hg-skip
Skip mercurial tests when hg is not available
2 parents 197195f + b447ca0 commit 2732199

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

testing/test_file_finder.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ def inwd(request, wd, monkeypatch):
1515
wd.add_command = "git add ."
1616
wd.commit_command = "git commit -m test-{reason}"
1717
elif request.param == "hg":
18-
wd("hg init")
18+
try:
19+
wd("hg init")
20+
except FileNotFoundError:
21+
pytest.skip("hg executable not found")
1922
wd.add_command = "hg add ."
2023
wd.commit_command = 'hg commit -m test-{reason} -u test -d "0 0"'
2124
(wd.cwd / "file1").touch()

testing/test_mercurial.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
from setuptools_scm.hg import archival_to_version, parse
33
from setuptools_scm import integration
44
from setuptools_scm.config import Configuration
5+
from setuptools_scm.utils import has_command
56
import pytest
7+
import warnings
8+
9+
10+
with warnings.catch_warnings():
11+
warnings.filterwarnings("ignore")
12+
if not has_command("hg"):
13+
pytestmark = pytest.mark.skip(reason="hg executable not found")
614

715

816
@pytest.fixture

0 commit comments

Comments
 (0)