Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ Release notes
# to document your changes. On releases it will be
# re-indented so that it does not show up in the notes.

.. _unreleased:
.. _unreleased:

Unreleased
----------
Unreleased
----------

Maintenance
~~~~~~~~~~~

* Add tests for all registry classes.
By :user:`Josh Moore <joshmoore>`, :issue:`349`.

.. _release_0.10.2:

Expand Down
23 changes: 23 additions & 0 deletions numcodecs/tests/test_registry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import pytest

import inspect

import numcodecs
from numcodecs.registry import get_codec


Expand All @@ -15,3 +17,24 @@ def test_get_codec_argument():
before = dict(arg)
get_codec(arg)
assert before == arg


def test_all_classes_registered():
"""
find all Codec subclasses in this repository and check that they
have been registered.

see #346 for more info
"""
missing = set()
for name, submod in inspect.getmembers(numcodecs, inspect.ismodule):
for name, obj in inspect.getmembers(submod):
if inspect.isclass(obj):
if issubclass(obj, numcodecs.abc.Codec):
if obj.codec_id not in numcodecs.registry.codec_registry:
missing.add(obj.codec_id)

# remove `None``
missing.remove(None)
if missing:
raise Exception(f"these codecs are missing: {missing}")