diff options
author | Michał Górny <mgorny@gentoo.org> | 2020-05-06 22:11:45 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2020-05-06 22:16:46 +0200 |
commit | b447ca04f2b0bb6f8a66fc47195f10f1b9ed2be5 (patch) | |
tree | d2235035f485707ec6e232dfd434b2abcfd68a01 | |
parent | 197195f52755142a97fa599d32dac83a5b5deb4a (diff) | |
download | setuptools-scm-b447ca04f2b0bb6f8a66fc47195f10f1b9ed2be5.tar.gz |
Skip mercurial tests when hg is not available
Mercurial is broken (read: crashing with bus error) on SPARC.
Nevertheless, many packages need setuptools_scm even if we never ever
use Mercurial checkouts. This patch makes it possible to run the test
suite successfully when Mercurial is not available on the system.
-rw-r--r-- | testing/test_file_finder.py | 5 | ||||
-rw-r--r-- | testing/test_mercurial.py | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/testing/test_file_finder.py b/testing/test_file_finder.py index c9409c4..d7b6d11 100644 --- a/testing/test_file_finder.py +++ b/testing/test_file_finder.py @@ -15,7 +15,10 @@ def inwd(request, wd, monkeypatch): wd.add_command = "git add ." wd.commit_command = "git commit -m test-{reason}" elif request.param == "hg": - wd("hg init") + try: + wd("hg init") + except FileNotFoundError: + pytest.skip("hg executable not found") wd.add_command = "hg add ." wd.commit_command = 'hg commit -m test-{reason} -u test -d "0 0"' (wd.cwd / "file1").touch() diff --git a/testing/test_mercurial.py b/testing/test_mercurial.py index c20c2fd..29370c1 100644 --- a/testing/test_mercurial.py +++ b/testing/test_mercurial.py @@ -2,7 +2,15 @@ from setuptools_scm import format_version from setuptools_scm.hg import archival_to_version, parse from setuptools_scm import integration from setuptools_scm.config import Configuration +from setuptools_scm.utils import has_command import pytest +import warnings + + +with warnings.catch_warnings(): + warnings.filterwarnings("ignore") + if not has_command("hg"): + pytestmark = pytest.mark.skip(reason="hg executable not found") @pytest.fixture |