@@ -249,6 +249,31 @@ def test_dir(library, module):
249
249
assert not fails , "Missing exports: %s" % fails
250
250
251
251
252
+ @pytest .mark .parametrize ("module" , list (NAMES ))
253
+ @pytest .mark .parametrize ("library" , wrapped_libraries )
254
+ def test_all (library , module ):
255
+ """Test that __all__ isn't missing any exports."""
256
+ modname = f"array_api_compat.{ library } "
257
+ pytest .importorskip (modname )
258
+ if module :
259
+ modname += f".{ module } "
260
+
261
+ objs = {}
262
+ exec (f"from { modname } import *" , objs )
263
+
264
+ missing = set (NAMES [module ]) - objs .keys ()
265
+ xfail = set (XFAILS .get ((library , module ), []))
266
+
267
+ # FIXME are these canonically meant to be in __all__?
268
+ if module == "" :
269
+ xfail |= {"__array_namespace_info__" , "__array_api_version__" }
270
+
271
+ xpass = xfail - missing
272
+ fails = missing - xfail
273
+ assert not xpass , "Names in XFAILS are defined: %s" % xpass
274
+ assert not fails , "Missing exports: %s" % fails
275
+
276
+
252
277
@pytest .mark .parametrize (
253
278
"name" , [name for name in NAMES ["" ] if hasattr (builtins , name )]
254
279
)
0 commit comments