-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix default entrypoint handling on older Pythons (#475)
- Loading branch information
Showing
8 changed files
with
43 additions
and
5 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
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
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
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,32 @@ | ||
import os.path | ||
import pkgutil | ||
import sys | ||
|
||
import pytest | ||
|
||
from multiprocessing import Process | ||
|
||
import numcodecs.registry | ||
|
||
if not pkgutil.find_loader("importlib_metadata"): # pragma: no cover | ||
pytest.skip("This test module requires importlib_metadata to be installed") | ||
|
||
here = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
|
||
def get_entrypoints_with_importlib_metadata_loaded(): | ||
# importlib_metadata patches importlib.metadata, which can lead to breaking changes | ||
# to the APIs of EntryPoint objects used when registering entrypoints. Attempt to | ||
# isolate those changes to just this test. | ||
import importlib_metadata # noqa: F401 | ||
sys.path.append(here) | ||
numcodecs.registry.run_entrypoints() | ||
cls = numcodecs.registry.get_codec({"id": "test"}) | ||
assert cls.codec_id == "test" | ||
|
||
|
||
def test_entrypoint_codec_with_importlib_metadata(): | ||
p = Process(target=get_entrypoints_with_importlib_metadata_loaded) | ||
p.start() | ||
p.join() | ||
assert p.exitcode == 0 |
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 |
---|---|---|
|
@@ -56,6 +56,9 @@ test = [ | |
"pytest", | ||
"pytest-cov", | ||
] | ||
test_extras = [ | ||
"importlib_metadata", | ||
] | ||
msgpack = [ | ||
"msgpack", | ||
] | ||
|