Skip to content

Commit

Permalink
Check that hg is actually working.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Jul 11, 2020
1 parent 4c9d572 commit fa929b4
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions run_unittests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2834,9 +2834,25 @@ def test_dist_git(self):
# 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')

Expand Down

0 comments on commit fa929b4

Please sign in to comment.