tests/heredoctest.py
branchstable
changeset 1108 168da136346a
parent 1107 943253aadddb
child 1109 8458561f6f94
equal deleted inserted replaced
1107:943253aadddb 1108:168da136346a
     1 import doctest, tempfile, os, sys
     1 import doctest, tempfile, os, sys
     2 
     2 
     3 if __name__ == "__main__":
     3 if __name__ == "__main__":
     4     fd, name = tempfile.mkstemp(suffix='hg-tst')
     4     fd, name = tempfile.mkstemp(suffix='hg-tst')
     5     os.write(fd, sys.stdin.read())
     5 
     6     os.close(fd)
     6     try:
     7     failures, _ = doctest.testfile(name, module_relative=False)
     7         os.write(fd, sys.stdin.read())
     8     if failures:
     8         os.close(fd)
     9         sys.exit(1)
     9         failures, _ = doctest.testfile(name, module_relative=False)
       
    10         if failures:
       
    11             sys.exit(1)
       
    12     finally:
       
    13         os.remove(name)