| 1 | n/a | """Test suite for packaging. |
|---|
| 2 | n/a | |
|---|
| 3 | n/a | This test suite consists of a collection of test modules in the |
|---|
| 4 | n/a | packaging.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 | Utility code is included in packaging.tests.support. |
|---|
| 9 | n/a | |
|---|
| 10 | n/a | Always import unittest from this module: it will be unittest from the |
|---|
| 11 | n/a | standard library for packaging tests and unittest2 for distutils2 tests. |
|---|
| 12 | n/a | """ |
|---|
| 13 | n/a | |
|---|
| 14 | n/a | import os |
|---|
| 15 | n/a | import sys |
|---|
| 16 | n/a | import unittest |
|---|
| 17 | n/a | |
|---|
| 18 | n/a | |
|---|
| 19 | n/a | def test_suite(): |
|---|
| 20 | n/a | suite = unittest.TestSuite() |
|---|
| 21 | n/a | here = os.path.dirname(__file__) or os.curdir |
|---|
| 22 | n/a | for fn in os.listdir(here): |
|---|
| 23 | n/a | if fn.startswith("test") and fn.endswith(".py"): |
|---|
| 24 | n/a | modname = "packaging.tests." + fn[:-3] |
|---|
| 25 | n/a | __import__(modname) |
|---|
| 26 | n/a | module = sys.modules[modname] |
|---|
| 27 | n/a | suite.addTest(module.test_suite()) |
|---|
| 28 | n/a | return suite |
|---|