changeset 45225:5a19d7c9129b stable

tests: skip doctests if not running from a hg repo Differential Revision: https://phab.mercurial-scm.org/D9150
author Joerg Sonnenberger <joerg@bec.de>
date Mon, 05 Oct 2020 15:08:15 +0200
parents a36cb826b1bb
children 366c547a8a57
files tests/test-doctest.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-doctest.py	Fri Oct 02 19:19:01 2020 +0530
+++ b/tests/test-doctest.py	Mon Oct 05 15:08:15 2020 +0200
@@ -4,7 +4,7 @@
 from __future__ import print_function
 
 import doctest
-import os
+import os.path
 import re
 import subprocess
 import sys
@@ -72,6 +72,9 @@
 
 cwd = os.path.dirname(os.environ["TESTDIR"])
 
+if not os.path.isdir(os.path.join(cwd, ".hg")):
+    sys.exit(0)
+
 files = subprocess.check_output(
     "hg files --print0 \"%s\"" % fileset, shell=True, cwd=cwd,
 ).split(b'\0')