PageRenderTime 42ms CodeModel.GetById 20ms app.highlight 3ms RepoModel.GetById 18ms app.codeStats 0ms

/Lib/distutils/tests/__init__.py

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