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