File: test_doc.py

package info (click to toggle)
ipy 1%3A1.01-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 268 kB
  • sloc: python: 1,774; makefile: 47; sh: 7
file content (29 lines) | stat: -rwxr-xr-x 904 bytes parent folder | download | duplicates (4)
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
29
#!/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")