Skip to content

test_entrypoints_backport and missing importlib_metadata #596

@stanislavlevin

Description

@stanislavlevin

The test suite of numcodecs 0.13.1 started to fail (importlib_metadata is not installed) with:

==================================== ERRORS ====================================
_ ERROR collecting .run_venv/lib64/python3/site-packages/numcodecs/tests/test_entrypoints_backport.py _
.run_venv/lib64/python3/site-packages/numcodecs/tests/test_entrypoints_backport.py:10: in <module>
    if not importlib.util.find_spec("importlib_metadata").loader:  # pragma: no cover
E   AttributeError: 'NoneType' object has no attribute 'loader'

Note: if importlib_metadata is not installed (this case) the find_spec returns None.
https://docs.python.org/3/library/importlib.html#importlib.util.find_spec

importlib.util.find_spec(name, package=None)(https://docs.python.org/3/library/importlib.html#importlib.util.find_spec)
Find the spec for a module, optionally relative to the specified package name. If the module is in sys.modules, then sys.modules[name].spec is returned (unless the spec would be None or is not set, in which case ValueError is raised). Otherwise a search using sys.meta_path is done. None is returned if no spec is found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions