Test that we don't add anything that looks like a new public module by accident. Check is based on filenames.
()
| 342 | # suppressing warnings from deprecated modules |
| 343 | @pytest.mark.filterwarnings("ignore:.*np.compat.*:DeprecationWarning") |
| 344 | def test_all_modules_are_expected(): |
| 345 | """ |
| 346 | Test that we don't add anything that looks like a new public module by |
| 347 | accident. Check is based on filenames. |
| 348 | """ |
| 349 | |
| 350 | modnames = [] |
| 351 | for _, modname, ispkg in pkgutil.walk_packages(path=np.__path__, |
| 352 | prefix=np.__name__ + '.', |
| 353 | onerror=None): |
| 354 | if is_unexpected(modname) and modname not in SKIP_LIST: |
| 355 | # We have a name that is new. If that's on purpose, add it to |
| 356 | # PUBLIC_MODULES. We don't expect to have to add anything to |
| 357 | # PRIVATE_BUT_PRESENT_MODULES. Use an underscore in the name! |
| 358 | modnames.append(modname) |
| 359 | |
| 360 | if modnames: |
| 361 | raise AssertionError(f'Found unexpected modules: {modnames}') |
| 362 | |
| 363 | |
| 364 | # Stuff that clearly shouldn't be in the API and is detected by the next test |
nothing calls this directly
no test coverage detected