File: wulfgar.py

package info (click to toggle)
pyephem 4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,380 kB
  • sloc: ansic: 77,574; python: 2,529; makefile: 74
file content (18 lines) | stat: -rw-r--r-- 748 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""Support test functions, in a module small enough to carry inline."""

from importlib import import_module
from unittest import TestCase
__unittest = 1  # Tell unittest not to include run() in test tracebacks.

tc = TestCase('setUp')
tc.maxDiff = 9999

def add_test_functions(loader, tests, module_name):
    """Run our main documentation as a test and test functions in this file."""

    module = import_module(module_name)
    test_methods = dict((name, staticmethod(getattr(module, name)))
                        for name in dir(module) if name.startswith('test_'))
    TestFunctions = type('TestFunctions', (TestCase,), test_methods)
    TestFunctions.__module__ = module_name
    tests.addTest(loader.loadTestsFromTestCase(TestFunctions))