1 | n/a | import os |
---|
2 | n/a | import sys |
---|
3 | n/a | import unittest |
---|
4 | n/a | |
---|
5 | n/a | |
---|
6 | n/a | here = os.path.dirname(__file__) |
---|
7 | n/a | loader = unittest.defaultTestLoader |
---|
8 | n/a | |
---|
9 | n/a | def suite(): |
---|
10 | n/a | suite = unittest.TestSuite() |
---|
11 | n/a | for fn in os.listdir(here): |
---|
12 | n/a | if fn.startswith("test") and fn.endswith(".py"): |
---|
13 | n/a | modname = "unittest.test." + fn[:-3] |
---|
14 | n/a | __import__(modname) |
---|
15 | n/a | module = sys.modules[modname] |
---|
16 | n/a | suite.addTest(loader.loadTestsFromModule(module)) |
---|
17 | n/a | suite.addTest(loader.loadTestsFromName('unittest.test.testmock')) |
---|
18 | n/a | return suite |
---|
19 | n/a | |
---|
20 | n/a | |
---|
21 | n/a | if __name__ == "__main__": |
---|
22 | n/a | unittest.main(defaultTest="suite") |
---|