|
Revision 4747, 0.5 kB
(checked in by haypo, 3 years ago)
|
|
Add script to check doctests
|
-
Property svn:eol-style set to
native
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | |
|---|
| 2 | import doctest |
|---|
| 3 | import sys |
|---|
| 4 | |
|---|
| 5 | def test(name): |
|---|
| 6 | mod = __import__(name) |
|---|
| 7 | for subname in name.split(".")[1:]: |
|---|
| 8 | mod = getattr(mod, subname) |
|---|
| 9 | print "=== Test %s ===" % mod.__name__ |
|---|
| 10 | failure, tests = doctest.testmod(mod) |
|---|
| 11 | return failure |
|---|
| 12 | |
|---|
| 13 | def main(): |
|---|
| 14 | failure = test("pynetfilter_conntrack.tools") |
|---|
| 15 | if not failure: |
|---|
| 16 | print "Everything is ok" |
|---|
| 17 | sys.exit(0) |
|---|
| 18 | else: |
|---|
| 19 | print "Total: %u failure" % failure |
|---|
| 20 | sys.exit(1) |
|---|
| 21 | |
|---|
| 22 | if __name__ == "__main__": |
|---|
| 23 | main() |
|---|