root/mirror/edenwall/pynetfilter_conntrack/trunk/test_doc.py

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#!/usr/bin/env python
2import doctest
3import sys
4
5def 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
13def 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
22if __name__ == "__main__":
23    main()
Note: See TracBrowser for help on using the browser.