2 import unittest
, os
, sys
5 coverage
.use_cache(False)
11 my_dir
= os
.path
.dirname(sys
.argv
[0])
15 testLoader
= unittest
.TestLoader()
18 alltests
= testLoader
.loadTestsFromNames(sys
.argv
[1:])
20 alltests
= unittest
.TestSuite()
22 suite_names
= [f
[:-3] for f
in os
.listdir(my_dir
)
23 if f
.startswith('test') and f
.endswith('.py')]
24 suite_names
.remove('testall')
27 for name
in suite_names
:
28 m
= __import__(name
, globals(), locals(), [])
29 t
= testLoader
.loadTestsFromModule(m
)
32 a
= unittest
.TextTestRunner(verbosity
=2).run(alltests
)
37 print "Coverage module not found. Skipping coverage report."
40 if not a
.wasSuccessful():
46 for x
in os
.listdir(d
):
48 all_sources
.append(os
.path
.join(d
, x
))
50 coverage
.report(all_sources
+ ['../0publish'])