view tests/heredoctest.py @ 15300:c2a75faf3b49 stable

convert: fix typo
author Eli Carter <eli.carter@tektronix.com>
date Tue, 18 Oct 2011 10:32:12 -0500
parents 3cd1605e9d8e
children 474279be5add
line wrap: on
line source

import doctest, tempfile, os, sys

if __name__ == "__main__":
    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)