comparison tests/test-doctest.py @ 45633: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 15aef805619d
children 4a146cff76fa
comparison
equal deleted inserted replaced
45561:a36cb826b1bb 45633:5a19d7c9129b
2 2
3 from __future__ import absolute_import 3 from __future__ import absolute_import
4 from __future__ import print_function 4 from __future__ import print_function
5 5
6 import doctest 6 import doctest
7 import os 7 import os.path
8 import re 8 import re
9 import subprocess 9 import subprocess
10 import sys 10 import sys
11 11
12 ispy3 = sys.version_info[0] >= 3 12 ispy3 = sys.version_info[0] >= 3
69 } 69 }
70 70
71 fileset = 'set:(**.py)' 71 fileset = 'set:(**.py)'
72 72
73 cwd = os.path.dirname(os.environ["TESTDIR"]) 73 cwd = os.path.dirname(os.environ["TESTDIR"])
74
75 if not os.path.isdir(os.path.join(cwd, ".hg")):
76 sys.exit(0)
74 77
75 files = subprocess.check_output( 78 files = subprocess.check_output(
76 "hg files --print0 \"%s\"" % fileset, shell=True, cwd=cwd, 79 "hg files --print0 \"%s\"" % fileset, shell=True, cwd=cwd,
77 ).split(b'\0') 80 ).split(b'\0')
78 81