mirror of
https://github.com/ivan-usov-org/bec.git
synced 2025-04-22 02:20:02 +02:00
22 lines
674 B
Python
22 lines
674 B
Python
import pytest
|
|
|
|
import bec_lib
|
|
from bec_lib import plugin_helper
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"class_spec, out_name",
|
|
[("bec_lib.messages.BECMessage", "BECMessage"), ("bec_lib.messages.BECStatus", "BECStatus")],
|
|
)
|
|
def test_get_plugin_class(class_spec, out_name):
|
|
cls = plugin_helper.get_plugin_class(class_spec, [bec_lib])
|
|
assert cls.__name__ == out_name
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"class_spec", ["bec_lib.nonexistent_module.NonexistentClass", "bec_lib.NonexistentClass"]
|
|
)
|
|
def test_get_plugin_class_module_not_found(class_spec):
|
|
with pytest.raises((ModuleNotFoundError, AttributeError)):
|
|
plugin_helper.get_plugin_class(class_spec, [bec_lib])
|