diff --git a/tests/test-doctest.py b/tests/test-doctest.py --- a/tests/test-doctest.py +++ b/tests/test-doctest.py @@ -6,7 +6,6 @@ import doctest import os import re -import subprocess import sys ispy3 = sys.version_info[0] >= 3 @@ -70,11 +69,18 @@ fileset = 'set:(**.py)' -cwd = os.path.dirname(os.environ["TESTDIR"]) +if ispy3: + cwd = os.path.dirname(os.environb[b"TESTDIR"]) +else: + cwd = os.path.dirname(os.environ["TESTDIR"]) -files = subprocess.check_output( - "hg files --print0 \"%s\"" % fileset, shell=True, cwd=cwd, -).split(b'\0') +files = [] +for dirpath, dirnames, filenames in os.walk(cwd): + dotdirindexes = reversed([i for i, dir in enumerate(dirnames) if dir.startswith(b'.')]) + for i in dotdirindexes: + del dirnames[i] + # include all .py files, removing the cwd + dirsep prefix + files.extend(os.path.join(dirpath, f)[len(cwd) + 1:] for f in filenames if f.endswith(b'.py')) if sys.version_info[0] >= 3: cwd = os.fsencode(cwd)