]> rtime.felk.cvut.cz Git - wvtest.git/blob - python/wvtestmain.py
Import wvtest for python from eqldata project.
[wvtest.git] / python / wvtestmain.py
1 #!/usr/bin/python
2 import wvtest
3 import sys, imp, types, os, os.path
4 import traceback
5
6 def runtest(modname, fname, f):
7     print
8     print 'Testing "%s" in %s.py:' % (fname, modname)
9     try:
10         f()
11     except Exception, e:
12         print
13         print traceback.format_exc()
14         tb = sys.exc_info()[2]
15         wvtest._result(e, traceback.extract_tb(tb)[-1],
16                        'EXCEPTION')
17
18 for modname in sys.argv[1:]:
19     if modname.endswith('.py'):
20         modname = modname[:-3]
21     print
22     print 'Importing: %s' % modname
23     wvtest._registered = []
24     mod = __import__(modname, None, None, [])
25
26     for t in wvtest._registered:
27         runtest(modname, t.func_name, t)
28                         
29 print
30 print 'WvTest: %d tests, %d failures.' % (wvtest._tests, wvtest._fails)