* Add https support (thanks to Andre Klärner)
[rss2maildir.git] / tests / runtests.py
1 #!/usr/bin/python
2
3 import unittest
4 import os
5
6 basedir = os.path.realpath(os.path.dirname(__file__))
7 unittestsdir = os.path.join( \
8     basedir, \
9     "unittests")
10
11 unittestmodules = []
12
13 fullsuite = unittest.TestSuite()
14
15 # walk our directory tree looking for any modules available
16 for root, dir, files in os.walk(unittestsdir):
17     for file in files:
18         if file[-3:] == ".py" and file != "__init__.py":
19             moduleinfo = ".".join(root[len(basedir)+1:].split(os.sep))
20             unittestmodules.append(".".join((moduleinfo, file[0:-3])))
21
22 # run through the found modules and look for test suites
23 for unittestmodule in unittestmodules:
24     # try importing the test and getting the suite
25     try:
26         suite_func = getattr(__import__(unittestmodule, {}, {}, ['']), "suite")
27         # add the suite to the tests
28         fullsuite.addTest(suite_func())
29     except:
30         # there was not test suite in there to run, skip it
31         pass
32
33 testrunner = unittest.TextTestRunner()
34 testrunner.run(fullsuite)