tests/heredoctest.py
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Fri, 16 Dec 2011 21:09:40 +0900
branchstable
changeset 15666 37a6e9765015
parent 15398 474279be5add
child 15434 5635a4017061
permissions -rw-r--r--
pathauditor: switch normcase logic according to case sensitivity of filesystem this patch applies 'util.normcase()' to audit path only on case insensitive filesystem.

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)