mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
36075d5498
Writes stdin to a temp file and doctests it. In the future we might want to spare the temp file and directly call into doctest. Also, with some tweaking it seems possible to adjust the line numbers reported in an error report so they match the ones in the original file.
10 lines
264 B
Python
10 lines
264 B
Python
import doctest, tempfile, os, sys
|
|
|
|
if __name__ == "__main__":
|
|
fd, name = tempfile.mkstemp(suffix='hg-tst')
|
|
os.write(fd, sys.stdin.read())
|
|
os.close(fd)
|
|
failures, _ = doctest.testfile(name, module_relative=False)
|
|
if failures:
|
|
sys.exit(1)
|