4 # vi: set softtabstop=4 shiftwidth=4 tabstop=8 expandtab:
7 # Creation Date: Jun 6, 2005
9 # Copyright: Copyright (c) 2005 CBN. All rights reserved.
12 """Runs all tests in the "tests" directory."""
20 """Returns a TestResult."""
22 testLoader
= unittest
.TestLoader()
23 suite
= unittest
.TestSuite()
25 collectTests(dir, testLoader
, suite
)
27 testRunner
= unittest
.TextTestRunner(verbosity
=1)
28 return testRunner
.run(suite
)
30 def collectTests(dir, testLoader
, suite
):
31 sys
.path
.insert(0, dir)
33 for f
in os
.listdir(dir):
34 comp
= os
.path
.splitext(f
)
36 suite
.addTest(testLoader
.loadTestsFromModule(__import__(comp
[0])))
38 if __name__
== '__main__':
39 result
= runAllTests("tests")
40 sys
.exit(not result
.wasSuccessful())