author | Idan Kamara <idankk86@gmail.com> |
Wed, 12 Oct 2011 22:01:13 +0200 | |
changeset 15235 | f7044da7a793 |
child 15247 | 3cd1605e9d8e |
permissions | -rw-r--r-- |
15235
f7044da7a793
tests: add helper script for processing doctests read from stdin
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
1 |
import doctest, tempfile, os, sys |
f7044da7a793
tests: add helper script for processing doctests read from stdin
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
2 |
|
f7044da7a793
tests: add helper script for processing doctests read from stdin
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
3 |
if __name__ == "__main__": |
f7044da7a793
tests: add helper script for processing doctests read from stdin
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
4 |
fd, name = tempfile.mkstemp(suffix='hg-tst') |
f7044da7a793
tests: add helper script for processing doctests read from stdin
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
5 |
os.write(fd, sys.stdin.read()) |
f7044da7a793
tests: add helper script for processing doctests read from stdin
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
6 |
os.close(fd) |
f7044da7a793
tests: add helper script for processing doctests read from stdin
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
7 |
failures, _ = doctest.testfile(name, module_relative=False) |
f7044da7a793
tests: add helper script for processing doctests read from stdin
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
8 |
if failures: |
f7044da7a793
tests: add helper script for processing doctests read from stdin
Idan Kamara <idankk86@gmail.com>
parents:
diff
changeset
|
9 |
sys.exit(1) |