forked from autocracy/python-ipy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_doc.py
executable file
·29 lines (24 loc) · 904 Bytes
/
test_doc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python
import doctest
import sys
if hasattr(doctest, "testfile"):
total_failures, total_tests = (0, 0)
print("=== Test file: README ===")
failure, tests = doctest.testfile('README.rst', optionflags=doctest.ELLIPSIS)
total_failures += failure
total_tests += tests
print("=== Test file: test.rst ===")
failure, tests = doctest.testfile('test/test.rst', optionflags=doctest.ELLIPSIS)
total_failures += failure
total_tests += tests
print("=== Test IPy module ===")
import IPy
failure, tests = doctest.testmod(IPy)
total_failures += failure
total_tests += tests
print("=== Overall Results ===")
print("total tests %d, failures %d" % (total_tests, total_failures))
if total_failures:
sys.exit(1)
else:
sys.stderr.write("WARNING: doctest has no function testfile (before Python 2.4), unable to check README\n")