[cad161]: / tests / test_entrypoints.py

Download this file

25 lines (19 with data), 603 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import catalogue
import pytest
try:
from importlib.metadata import entry_points
except ImportError:
from importlib_metadata import entry_points
try:
import torch.nn
except ImportError:
torch = None
if torch is None:
pytest.skip("torch not installed", allow_module_level=True)
def test_entrypoints():
ep = entry_points()
namespaces = ep.groups if hasattr(ep, "groups") else ep.keys()
for ns in namespaces:
if ns.startswith("spacy_") or ns.startswith("edsnlp_"):
reg = catalogue.Registry(ns.split("_"), entry_points=True)
reg.get_all()