From 58e4dc55c30246d78323f1e4ace02cd153921b81 Mon Sep 17 00:00:00 2001 From: Mikko Korpela Date: Sat, 20 Jan 2024 16:54:31 +0200 Subject: [PATCH] sharedlib --- src/pabot/pabotlib.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pabot/pabotlib.py b/src/pabot/pabotlib.py index 9c1a547c..f13f0b2b 100644 --- a/src/pabot/pabotlib.py +++ b/src/pabot/pabotlib.py @@ -32,6 +32,7 @@ from robot.libraries.BuiltIn import BuiltIn from robot.libraries.Remote import Remote from robot.utils.importer import Importer +from robot.libraries import STDLIBS from .robotremoteserver import RobotRemoteServer @@ -157,9 +158,13 @@ def add_value_to_set(self, name, content): def import_shared_library(self, name, args=None): # type: (str, Iterable[Any]|None) -> int if name in self._remote_libraries: return self._remote_libraries[name][0] - imported = Importer().import_class_or_module(name_or_path=name, instantiate_with_args=args) + if name in STDLIBS: + import_name = 'robot.libraries.' + name + else: + import_name = name + imported = Importer('library').import_class_or_module(name_or_path=import_name, instantiate_with_args=args) server = RobotRemoteServer( - imported.get_instance(), port=0, serve=False, allow_stop=True + imported, port=0, serve=False, allow_stop=True ) server_thread = threading.Thread(target=server.serve) server_thread.start()