tests/heredoctest.py
author Matt Mackall <mpm@selenic.com>
Thu, 01 Dec 2011 15:51:36 -0600
branchstable
changeset 15600 195dbd1cef0c
parent 15398 474279be5add
child 15434 5635a4017061
permissions -rw-r--r--
alias: shortcut command matching show shadowing works properly (issue3104) An alias for 'log' was stored in the same command table as '^log|history'. If the hash function happens to give the latter first, the alias is effectively ignored when matching 'log'.

import doctest, tempfile, os, sys

if __name__ == "__main__":
    if 'TERM' in os.environ:
        del os.environ['TERM']

    fd, name = tempfile.mkstemp(suffix='hg-tst')

    try:
        os.write(fd, sys.stdin.read())
        os.close(fd)
        failures, _ = doctest.testfile(name, module_relative=False)
        if failures:
            sys.exit(1)
    finally:
        os.remove(name)