Skip to content
Snippets Groups Projects
Commit 98d1777d authored by David Hammer's avatar David Hammer
Browse files

Fix addon filter from entry_points

parent 17ff0c9f
No related branches found
No related tags found
1 merge request!116Fix addon filter from entry_points
...@@ -1043,7 +1043,7 @@ def add_addon_nodes(schema, device_class, prefix="addons"): ...@@ -1043,7 +1043,7 @@ def add_addon_nodes(schema, device_class, prefix="addons"):
addon.load() addon.load()
for addon in entry_points().select().get("calng.correction_addon", []) for addon in entry_points().select().get("calng.correction_addon", [])
if not addon.extras if not addon.extras
or det_name in (extra[0] for extra in addon.extras) or det_name in addon.extras
] ]
for addon_class in device_class._available_addons: for addon_class in device_class._available_addons:
......
...@@ -319,6 +319,7 @@ class Gotthard2Correction(base_correction.BaseCorrection): ...@@ -319,6 +319,7 @@ class Gotthard2Correction(base_correction.BaseCorrection):
def expectedParameters(cls, expected): def expectedParameters(cls, expected):
cls._calcat_friend_class.add_schema(expected) cls._calcat_friend_class.add_schema(expected)
cls._kernel_runner_class.add_schema(expected) cls._kernel_runner_class.add_schema(expected)
base_correction.add_addon_nodes(expected, cls)
PreviewFriend.add_schema(expected, cls._preview_outputs) PreviewFriend.add_schema(expected, cls._preview_outputs)
( (
OUTPUT_CHANNEL(expected) OUTPUT_CHANNEL(expected)
......
...@@ -461,6 +461,7 @@ class JungfrauCorrection(base_correction.BaseCorrection): ...@@ -461,6 +461,7 @@ class JungfrauCorrection(base_correction.BaseCorrection):
def expectedParameters(cls, expected): def expectedParameters(cls, expected):
cls._calcat_friend_class.add_schema(expected) cls._calcat_friend_class.add_schema(expected)
JungfrauBaseRunner.add_schema(expected) JungfrauBaseRunner.add_schema(expected)
base_correction.add_addon_nodes(expected, cls)
PreviewFriend.add_schema(expected, cls._preview_outputs) PreviewFriend.add_schema(expected, cls._preview_outputs)
( (
OUTPUT_CHANNEL(expected) OUTPUT_CHANNEL(expected)
......
from karabo.bound import Configurator, Schema
from calng.correction_addons import litpixel_counter, random_frames
from calng.corrections import (
AgipdCorrection,
DsscCorrection,
Epix100Correction,
Gotthard2Correction,
JungfrauCorrection,
LpdCorrection,
LpdminiCorrection,
PnccdCorrection,
)
def test_available_addons():
all_device_classes = [
AgipdCorrection,
DsscCorrection,
Epix100Correction,
Gotthard2Correction,
JungfrauCorrection,
LpdCorrection,
LpdminiCorrection,
PnccdCorrection,
]
actual_classes = [
getattr(cls, cls.__name__.rpartition(".")[-1]) for cls in all_device_classes
]
configurator = Configurator("PythonDevice")
for cls in actual_classes:
schema_hash = configurator.getSchema(cls).getParameterHash()
# everyone should have RandomFrames
assert random_frames.RandomFrames in cls._available_addons # available
assert schema_hash.has("addons.RandomFrames") # and in schema
# only AGIPD has the litpixelcounter (for now)
if cls == AgipdCorrection.AgipdCorrection:
assert litpixel_counter.LitPixelCounter in cls._available_addons
assert schema_hash.has("addons.LitPixelCounter")
else:
assert litpixel_counter.LitPixelCounter not in cls._available_addons
assert not schema_hash.has("addons.LitPixelCounter")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment