tests/heredoctest.py
author Mads Kiilerich <mads@kiilerich.com>
Tue, 22 Nov 2011 19:56:26 +0100
branchstable
changeset 15554 0c0ed2b3082d
parent 15398 474279be5add
child 15434 5635a4017061
permissions -rw-r--r--
tests: test-largefiles.t should not try to escape from $TESTTMP

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)