Script to grab stop codes from allstops.xml and sort
[ottawa-travel-planner.git] / runtests.py
blob923accf7ccbed94d443894d0ee6f6ef052638152
1 #!/usr/bin/python
3 # runtests.py
4 # vi: set softtabstop=4 shiftwidth=4 tabstop=8 expandtab:
6 # Author: michael
7 # Creation Date: Jun 6, 2005
9 # Copyright: Copyright (c) 2005 CBN. All rights reserved.
12 """Runs all tests in the "tests" directory."""
14 import unittest
15 import os
16 import sys
17 import os.path
19 def runAllTests(dir):
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)
35 if comp[1] == ".py":
36 suite.addTest(testLoader.loadTestsFromModule(__import__(comp[0])))
38 if __name__ == '__main__':
39 result = runAllTests("tests")
40 sys.exit(not result.wasSuccessful())