From: Michael Fladischer <FladischerMichael@fladi.at>
Date: Sun, 13 Oct 2019 10:59:53 +0200
Subject: Skip tests correctly when hg/git is not installed.

---
 tests/test_cli.py | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/tests/test_cli.py b/tests/test_cli.py
index 6e68388..a0a126a 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -30,15 +30,21 @@ call = partial(subprocess.call, env=SUBPROCESS_ENV, shell=True)
 check_call = partial(subprocess.check_call, env=SUBPROCESS_ENV)
 check_output = partial(subprocess.check_output,  env=SUBPROCESS_ENV)
 
-xfail_if_no_git = pytest.mark.xfail(
-  call("git version") != 0,
-  reason="git is not installed"
-)
+try:
+    xfail_if_no_git = pytest.mark.xfail(
+        subprocess.call(["git", "version"]) != 0,
+        reason="git is not installed"
+    )
+except FileNotFoundError:
+    xfail_if_no_git = pytest.mark.xfail(True, reason="git is not installed")
 
-xfail_if_no_hg = pytest.mark.xfail(
-  call("hg version") != 0,
-  reason="hg is not installed"
-)
+try:
+    xfail_if_no_hg = pytest.mark.xfail(
+        subprocess.call(["hg", "version"]) != 0,
+        reason="hg is not installed"
+    )
+except FileNotFoundError:
+    xfail_if_no_hg = pytest.mark.xfail(True, reason="hg is not installed")
 
 VCS_GIT = pytest.param("git", marks=xfail_if_no_git())
 VCS_MERCURIAL = pytest.param("hg", marks=xfail_if_no_hg())
