view tests/heredoctest.py @ 15366:06b8db3f25c6 stable

largefiles: test reverting largefiles (coverage creeping ever upwards) This reveals a small bug: revert reports "reverting .hglf/largefile" when it really should report "reverting largefile". I don't see an easy fix, though (short of using ui.pushbuffer() to interfere with revert's output).
author Greg Ward <greg@gerg.ca>
date Tue, 25 Oct 2011 08:56:59 -0400
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)