diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2020-07-03 05:05:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-03 05:05:29 -0400 |
commit | 2daf7f68fee8d5b62ee067143aa5bf1ece66c331 (patch) | |
tree | 4057aeefb3d919e8af7b4d9a8ccde3dde3fe8046 /setuptools/_distutils/tests/__init__.py | |
parent | c486771a15642d69622b9afeb9178450daf02e24 (diff) | |
parent | 97192962e89a24a02effd1f7a541108335517253 (diff) | |
download | external_python_setuptools-2daf7f68fee8d5b62ee067143aa5bf1ece66c331.tar.gz external_python_setuptools-2daf7f68fee8d5b62ee067143aa5bf1ece66c331.tar.bz2 external_python_setuptools-2daf7f68fee8d5b62ee067143aa5bf1ece66c331.zip |
Merge pull request #2226 from pypa/distutils-nested
Move distutils to setuptools._distutils
Diffstat (limited to 'setuptools/_distutils/tests/__init__.py')
-rw-r--r-- | setuptools/_distutils/tests/__init__.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/setuptools/_distutils/tests/__init__.py b/setuptools/_distutils/tests/__init__.py new file mode 100644 index 00000000..5d2e69e3 --- /dev/null +++ b/setuptools/_distutils/tests/__init__.py @@ -0,0 +1,42 @@ +"""Test suite for distutils. + +This test suite consists of a collection of test modules in the +distutils.tests package. Each test module has a name starting with +'test' and contains a function test_suite(). The function is expected +to return an initialized unittest.TestSuite instance. + +Tests for the command classes in the distutils.command package are +included in distutils.tests as well, instead of using a separate +distutils.command.tests package, since command identification is done +by import rather than matching pre-defined names. + +""" + +import os +import sys +import unittest +import warnings +from test.support import run_unittest + + +here = os.path.dirname(__file__) or os.curdir + + +def test_suite(): + old_filters = warnings.filters[:] + suite = unittest.TestSuite() + for fn in os.listdir(here): + if fn.startswith("test") and fn.endswith(".py"): + modname = "distutils.tests." + fn[:-3] + __import__(modname) + module = sys.modules[modname] + suite.addTest(module.test_suite()) + # bpo-40055: Save/restore warnings filters to leave them unchanged. + # Importing tests imports docutils which imports pkg_resources which adds a + # warnings filter. + warnings.filters[:] = old_filters + return suite + + +if __name__ == "__main__": + run_unittest(test_suite()) |