view tests/heredoctest.py @ 15570:0f208626d503 stable

largefiles: add comment about non-atomic working directory When updating the working copy with a normal 'hg update', we also don't use atomic writes.
author Martin Geisler <mg@aragost.com>
date Thu, 24 Nov 2011 18:11:43 +0100
parents 474279be5add
children 5635a4017061
line wrap: on
line source

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)