1 | n/a | """Test suite for distutils. |
---|
2 | n/a | |
---|
3 | n/a | This test suite consists of a collection of test modules in the |
---|
4 | n/a | distutils.tests package. Each test module has a name starting with |
---|
5 | n/a | 'test' and contains a function test_suite(). The function is expected |
---|
6 | n/a | to return an initialized unittest.TestSuite instance. |
---|
7 | n/a | |
---|
8 | n/a | Tests for the command classes in the distutils.command package are |
---|
9 | n/a | included in distutils.tests as well, instead of using a separate |
---|
10 | n/a | distutils.command.tests package, since command identification is done |
---|
11 | n/a | by import rather than matching pre-defined names. |
---|
12 | n/a | |
---|
13 | n/a | """ |
---|
14 | n/a | |
---|
15 | n/a | import os |
---|
16 | n/a | import sys |
---|
17 | n/a | import unittest |
---|
18 | n/a | from test.support import run_unittest |
---|
19 | n/a | |
---|
20 | n/a | |
---|
21 | n/a | here = os.path.dirname(__file__) or os.curdir |
---|
22 | n/a | |
---|
23 | n/a | |
---|
24 | n/a | def test_suite(): |
---|
25 | n/a | suite = unittest.TestSuite() |
---|
26 | n/a | for fn in os.listdir(here): |
---|
27 | n/a | if fn.startswith("test") and fn.endswith(".py"): |
---|
28 | n/a | modname = "distutils.tests." + fn[:-3] |
---|
29 | n/a | __import__(modname) |
---|
30 | n/a | module = sys.modules[modname] |
---|
31 | n/a | suite.addTest(module.test_suite()) |
---|
32 | n/a | return suite |
---|
33 | n/a | |
---|
34 | n/a | |
---|
35 | n/a | if __name__ == "__main__": |
---|
36 | n/a | run_unittest(test_suite()) |
---|