Read about our upcoming Code of Conduct on this issue

This instance was upgraded to Heptapod 0.28.0 today

Commit 7e2b8f51 authored by Gregory Szorc's avatar Gregory Szorc
Browse files

tests: perform grep manually in test-doctest.py

This test has been failing on Windows since 0af56d3ee24c
introduced the `hg files` invocation. Specifically, Windows seems
to be choking on special characters in the fileset pattern. I
believe at least \n and > were causing issues.

I attempted various incantations to make the Windows command line
parser accept the fileset but couldn't get anything working.
I declared bankruptcy and just reimplemented the grepping code
in Python.

After this change, the test now passes on Windows again.

Differential Revision: https://phab.mercurial-scm.org/D8343
parent 47e6ec977555
......@@ -68,20 +68,26 @@ testmod_arg_overrides = {
'tests.test-url': [{'optionflags': doctest.NORMALIZE_WHITESPACE}],
}
doctest_indicator = '\n\\s*>>> '
fileset = 'set:(**.py and grep("%s"))' % doctest_indicator
fileset = 'set:(**.py)'
cwd = os.path.dirname(os.environ["TESTDIR"])
files = subprocess.check_output(
"hg files --print0 '%s'" % fileset,
shell=True,
cwd=os.path.dirname(os.environ['TESTDIR']),
"hg files --print0 \"%s\"" % fileset, shell=True, cwd=cwd,
).split(b'\0')
if sys.version_info[0] >= 3:
cwd = os.fsencode(cwd)
mods_tested = set()
for f in files:
if not f:
continue
with open(os.path.join(cwd, f), "rb") as fh:
if not re.search(br'\n\s*>>>', fh.read()):
continue
if ispy3:
f = f.decode()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment