summaryrefslogtreecommitdiff
path: root/setuptools/_distutils/tests/__init__.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-11-12 19:37:53 -0500
committerJason R. Coombs <jaraco@jaraco.com>2021-11-12 19:37:53 -0500
commit26d7411464115c6170ed666e72e388d53d4b7fd2 (patch)
tree40a141e309c856e1af1df3dc2ec7699288d3d384 /setuptools/_distutils/tests/__init__.py
parent342e02e7a4dbedf0e3a04c4d2d213b5340d56010 (diff)
parent77678abf97b4a8ee5e6e67b14cb21f543cd6bfd9 (diff)
downloadpython-setuptools-git-feature/local-schemes.tar.gz
Merge branch 'main' into feature/local-schemesfeature/local-schemes
Diffstat (limited to 'setuptools/_distutils/tests/__init__.py')
-rw-r--r--setuptools/_distutils/tests/__init__.py42
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..c7dcc7ec
--- /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
+from test.support import run_unittest
+
+from .py38compat import save_restore_warnings_filters
+
+
+here = os.path.dirname(__file__) or os.curdir
+
+
+def test_suite():
+ suite = unittest.TestSuite()
+ for fn in os.listdir(here):
+ if fn.startswith("test") and fn.endswith(".py"):
+ modname = "distutils.tests." + fn[:-3]
+ # bpo-40055: Save/restore warnings filters to leave them unchanged.
+ # Importing tests imports docutils which imports pkg_resources
+ # which adds a warnings filter.
+ with save_restore_warnings_filters():
+ __import__(modname)
+ module = sys.modules[modname]
+ suite.addTest(module.test_suite())
+ return suite
+
+
+if __name__ == "__main__":
+ run_unittest(test_suite())