@@ -15,20 +15,26 @@ |
|
|
15 |
15 |
import os |
16 |
16 |
import sys |
17 |
17 |
import unittest |
|
18 |
+import warnings |
18 |
19 |
from test.support import run_unittest |
19 |
20 |
|
20 |
21 |
|
21 |
22 |
here = os.path.dirname(__file__) or os.curdir |
22 |
23 |
|
23 |
24 |
|
24 |
25 |
def test_suite(): |
|
26 |
+old_filters = warnings.filters[:] |
25 |
27 |
suite = unittest.TestSuite() |
26 |
28 |
for fn in os.listdir(here): |
27 |
29 |
if fn.startswith("test") and fn.endswith(".py"): |
28 |
30 |
modname = "distutils.tests." + fn[:-3] |
29 |
31 |
__import__(modname) |
30 |
32 |
module = sys.modules[modname] |
31 |
33 |
suite.addTest(module.test_suite()) |
|
34 |
+# bpo-40055: Save/restore warnings filters to leave them unchanged. |
|
35 |
+# Importing tests imports docutils which imports pkg_resources which adds a |
|
36 |
+# warnings filter. |
|
37 |
+warnings.filters[:] = old_filters |
32 |
38 |
return suite |
33 |
39 |
|
34 |
40 |
|