When publishing, check that no more commits have been made.
[0release.git] / tests / testall.py
blob7da6c30607bdc0c9e5f6e891923dcc850c405883
1 #!/usr/bin/env python2.4
2 import unittest, os, sys
3 try:
4 import coverage
5 coverage.erase()
6 coverage.start()
7 except ImportError:
8 coverage = None
10 my_dir = os.path.dirname(sys.argv[0])
11 if not my_dir:
12 my_dir = os.getcwd()
14 sys.argv.append('-v')
16 suite_names = [f[:-3] for f in os.listdir(my_dir)
17 if f.startswith('test') and f.endswith('.py')]
18 suite_names.remove('testall')
19 suite_names.sort()
21 alltests = unittest.TestSuite()
23 for name in suite_names:
24 m = __import__(name, globals(), locals(), [])
25 alltests.addTest(m.suite)
27 a = unittest.TextTestRunner(verbosity=2).run(alltests)
29 if coverage:
30 coverage.stop()
31 else:
32 print "Coverage module not found. Skipping coverage report."
34 print "\nResult", a
35 if not a.wasSuccessful():
36 sys.exit(1)
38 if coverage:
39 all_sources = []
40 def incl(d):
41 for x in os.listdir(d):
42 if x.endswith('.py'):
43 all_sources.append(os.path.join(d, x))
44 incl('..')
45 coverage.report(all_sources + ['../0publish'])