heredoctest.py
16 lines
| 392 B
| text/x-python
|
PythonLexer
/ tests / heredoctest.py
Idan Kamara
|
r15235 | import doctest, tempfile, os, sys | ||
if __name__ == "__main__": | ||||
Brodie Rao
|
r15398 | if 'TERM' in os.environ: | ||
del os.environ['TERM'] | ||||
Idan Kamara
|
r15235 | fd, name = tempfile.mkstemp(suffix='hg-tst') | ||
Idan Kamara
|
r15247 | |||
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) | ||||