-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Allow codec registry via entrypoints * remove debug * Add release note * Add test * Mark required but unused test methods as no cover * better exception * Skip test is no entryoints * Add logging
- Loading branch information
1 parent
500c048
commit ed22a59
Showing
6 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
numcodecs/tests/package_with_entrypoint-0.1.dist-info/entry_points.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[numcodecs.codecs] | ||
test = package_with_entrypoint:TestCodec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from numcodecs.abc import Codec | ||
|
||
|
||
class TestCodec(Codec): | ||
|
||
codec_id = "test" | ||
|
||
def encode(self, buf): # pragma: no cover | ||
pass | ||
|
||
def decode(self, buf, out=None): # pragma: no cover | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import os.path | ||
import sys | ||
|
||
import pytest | ||
|
||
import numcodecs.registry | ||
|
||
|
||
here = os.path.abspath(os.path.dirname(__file__)) | ||
pytest.importorskip("entrypoints") | ||
|
||
|
||
@pytest.fixture() | ||
def set_path(): | ||
sys.path.append(here) | ||
numcodecs.registry.run_entrypoints() | ||
yield | ||
sys.path.remove(here) | ||
numcodecs.registry.run_entrypoints() | ||
numcodecs.registry.codec_registry.pop("test") | ||
|
||
|
||
def test_entrypoint_codec(set_path): | ||
cls = numcodecs.registry.get_codec({"id": "test"}) | ||
assert cls.codec_id == "test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
coverage | ||
coveralls | ||
entrypoints | ||
flake8 | ||
pytest | ||
pytest-cov | ||
|