summaryrefslogtreecommitdiffstats
path: root/Lib/test/test___all__.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test___all__.py')
-rw-r--r--Lib/test/test___all__.py36
1 files changed, 21 insertions, 15 deletions
diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py
index f6e82eb..c077881 100644
--- a/Lib/test/test___all__.py
+++ b/Lib/test/test___all__.py
@@ -30,21 +30,27 @@ class AllTest(unittest.TestCase):
raise NoAll(modname)
names = {}
with self.subTest(module=modname):
- try:
- exec("from %s import *" % modname, names)
- except Exception as e:
- # Include the module name in the exception string
- self.fail("__all__ failure in {}: {}: {}".format(
- modname, e.__class__.__name__, e))
- if "__builtins__" in names:
- del names["__builtins__"]
- if '__annotations__' in names:
- del names['__annotations__']
- keys = set(names)
- all_list = sys.modules[modname].__all__
- all_set = set(all_list)
- self.assertCountEqual(all_set, all_list, "in module {}".format(modname))
- self.assertEqual(keys, all_set, "in module {}".format(modname))
+ with support.check_warnings(
+ ("", DeprecationWarning),
+ ("", ResourceWarning),
+ quiet=True):
+ try:
+ exec("from %s import *" % modname, names)
+ except Exception as e:
+ # Include the module name in the exception string
+ self.fail("__all__ failure in {}: {}: {}".format(
+ modname, e.__class__.__name__, e))
+ if "__builtins__" in names:
+ del names["__builtins__"]
+ if '__annotations__' in names:
+ del names['__annotations__']
+ if "__warningregistry__" in names:
+ del names["__warningregistry__"]
+ keys = set(names)
+ all_list = sys.modules[modname].__all__
+ all_set = set(all_list)
+ self.assertCountEqual(all_set, all_list, "in module {}".format(modname))
+ self.assertEqual(keys, all_set, "in module {}".format(modname))
def walk_modules(self, basedir, modpath):
for fn in sorted(os.listdir(basedir)):