Skip to content

Commit f2482cb

Browse files
committed
tests: add a __dir__ check to the __all__test
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
1 parent 8c0858b commit f2482cb

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Lib/test/test___all__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def check_all(self, modname):
4848
raise FailedImport(modname)
4949
if not hasattr(sys.modules[modname], "__all__"):
5050
raise NoAll(modname)
51+
5152
names = {}
5253
with self.subTest(module=modname):
5354
with warnings_helper.check_warnings(
@@ -72,6 +73,9 @@ def check_all(self, modname):
7273
all_set = set(all_list)
7374
self.assertCountEqual(all_set, all_list, "in module {}".format(modname))
7475
self.assertEqual(keys, all_set, "in module {}".format(modname))
76+
# Verify __dir__ is non-empty and doesn't produce an error
77+
self.assertTrue(dir(sys.modules[modname]))
78+
7579

7680
def walk_modules(self, basedir, modpath):
7781
for fn in sorted(os.listdir(basedir)):

0 commit comments

Comments
 (0)