Mercurial > public > mercurial-scm > hg-stable
diff tests/test-run-tests.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | aaad36b88298 |
children | 75b623801f6a |
line wrap: on
line diff
--- a/tests/test-run-tests.py Sat Oct 05 10:29:34 2019 -0400 +++ b/tests/test-run-tests.py Sun Oct 06 09:45:02 2019 -0400 @@ -8,11 +8,13 @@ import doctest import os import re + # this is hack to make sure no escape characters are inserted into the output if 'TERM' in os.environ: del os.environ['TERM'] run_tests = __import__('run-tests') + def prn(ex): m = ex.args[0] if isinstance(m, str): @@ -20,6 +22,7 @@ else: print(m.decode('utf-8')) + def lm(expected, output): r"""check if output matches expected @@ -35,10 +38,12 @@ ... except AssertionError as ex: prn(ex) single backslash or unknown char """ - assert (expected.endswith(b'\n') - and output.endswith(b'\n')), 'missing newline' - assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), ( - b'single backslash or unknown char') + assert expected.endswith(b'\n') and output.endswith( + b'\n' + ), 'missing newline' + assert not re.search( + br'[^ \w\\/\r\n()*?]', expected + output + ), b'single backslash or unknown char' test = run_tests.TTest(b'test-run-test.t', b'.', b'.') match, exact = test.linematch(expected, output) if isinstance(match, str): @@ -46,7 +51,8 @@ elif isinstance(match, bytes): return 'special: ' + match.decode('utf-8') else: - return bool(match) # do not return match object + return bool(match) # do not return match object + def wintests(): r"""test matching like running on windows @@ -77,6 +83,7 @@ """ pass + def otherostests(): r"""test matching like running on non-windows os @@ -104,5 +111,6 @@ """ pass + if __name__ == '__main__': doctest.testmod()