blob: f998541b6f6ff7f8fa9db4a51ef74a430404fc50 (
plain) (
blame)
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
30
31
32
33
34
35
36
37
38
39
40
|
"""Usage: python test.py [module]
When called without an optional module name, run the doctests from
*all* modules. This may raise lots of errors if you haven't installed
one of the versioning control systems.
When called with an optional module name, only run the doctests from
that module.
"""
from libbe import plugin
import doctest
import sys
if len(sys.argv) > 1:
match = False
libbe_failures = libbe_tries = becommands_failures = becommands_tries = 0
mod = plugin.get_plugin("libbe", sys.argv[1])
if mod is not None:
libbe_failures, libbe_tries = doctest.testmod(mod)
match = True
mod = plugin.get_plugin("becommands", sys.argv[1])
if mod is not None:
becommands_failures, becommands_tries = doctest.testmod(mod)
match = True
if not match:
print "No modules match \"%s\"" % sys.argv[1]
sys.exit(1)
else:
sys.exit(libbe_failures or becommands_failures)
else:
failed = False
for module in plugin.iter_plugins("libbe"):
failures, tries = doctest.testmod(module[1])
if failures:
failed = True
for module in plugin.iter_plugins("becommands"):
failures, tries = doctest.testmod(module[1])
if failures:
failed = True
sys.exit(failed)
|