Skip to content

Commit 2f84176

Browse files
committed
With base class
1 parent 3c7f25f commit 2f84176

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/robotlibcore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def parse_plugins(self, plugins: str) -> typing.List:
299299
plugin = plugin(*parsed_plugin.args, **parsed_plugin.kw_args)
300300
if self._base_class and not isinstance(plugin, self._base_class):
301301
message = (
302-
"Plugin does not inherit SeleniumLibrary.base.LibraryComponent"
302+
f"Plugin does not inherit {self._base_class}"
303303
)
304304
raise PluginError(message)
305305
imported_plugins.append(plugin)

utest/test_plugin_api.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from robotlibcore import Module, PluginParser
3+
from robotlibcore import Module, PluginParser, PluginError
44
import my_plugin_test
55

66

@@ -46,5 +46,13 @@ def test_parse_plugins(plugin_parser):
4646
assert len(plugins) == 2
4747
assert isinstance(plugins[0], my_plugin_test.TestClass)
4848
assert isinstance(plugins[1], my_plugin_test.TestClassWithBase)
49-
5049

50+
51+
def test_parse_plugins_with_base():
52+
parser = PluginParser(my_plugin_test.LibraryBase)
53+
plugins = parser.parse_plugins("my_plugin_test.TestClassWithBase")
54+
assert len(plugins) == 1
55+
assert isinstance(plugins[0], my_plugin_test.TestClassWithBase)
56+
with pytest.raises(PluginError) as excinfo:
57+
parser.parse_plugins("my_plugin_test.TestClass")
58+
assert "Plugin does not inherit <class 'my_plugin_test.LibraryBase'>" in str(excinfo.value)

0 commit comments

Comments
 (0)