Did anyone used PythonLibCore together with the dynamic library api or know how to use it?
Here is an short example (does not contains required imports):
dynamic_lib.py
from robot.api.deco import library
from robotlibcore import DynamicCore
from DynamicLib.lib_a import LibA
@library
class DynamicLib(DynamicCore):
def __init__(self):
DynamicCore.__init__(self, [LibA()])
lib_a.py
from typing import Any, List, Dict
from robot.api.deco import library
from robot.api.interfaces import DynamicLibrary
@library
class LibA(DynamicLibrary): # DynamicLibrary: abstract baseclass for interface
def get_keyword_names(self) -> List[str]:
return ['A Keyword 1', 'A Keyword 2']
def run_keyword(self, name: str, args: List[Any], named: Dict[str, Any]) -> Any:
pass
If i understand what you are trying to accomplish, your LibA class should inherit LibraryComponent and not DynamicLibrary.
Second, you should be using @keyword decorator in LibA and thus, list of keywords should be automatically available so there’s no need for get_keyword_names().
And finally, run_keyword() shouldn’t be necessary either.
I updated the initial post with the imports, so the example should be more clear.
@rasjani: DynamicLibrary is an abstract baseclass for implementing the dynamic library interface and there is no LibraryComponent in PythonLibCore.
I am implementing a dynamic library, not a static library, so there are no methods as keywords and I need to implement get_keyword_names() and run_keyword().