summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-07-11 21:00:45 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2020-07-11 21:01:24 +0300
commitb7519d9b3d4b581dfcf12c4d96cb19ae7822f7e0 (patch)
tree11387cc8bdfbd2cc7231a85e48d92145ea32fe26
parente1ffff899557f18da377dcb8ab041708fda3ccf4 (diff)
downloadmeson-java17.tar.gz
Check that hg is actually working.java17
-rwxr-xr-xrun_unittests.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 5fd790c42..820b705b5 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -2834,9 +2834,25 @@ class AllPlatformTests(BasePlatformTests):
# fails sometimes.
pass
- def test_dist_hg(self):
+ def has_working_hg(self):
if not shutil.which('hg'):
- raise unittest.SkipTest('Mercurial not found')
+ return False
+ try:
+ # This check should not be necessary, but
+ # CI under macOS passes the above test even
+ # though Mercurial is not installed.
+ if subprocess.call(['hg', '--version'],
+ stdout=subprocess.DEVNULL,
+ stderr=subprocess.DEVNULL) != 0:
+ return False
+ return True
+ except FileNotFoundError:
+ return False
+
+
+ def test_dist_hg(self):
+ if not self.has_working_hg():
+ raise unittest.SkipTest('Mercurial not found or broken.')
if self.backend is not Backend.ninja:
raise unittest.SkipTest('Dist is only supported with Ninja')