Skip to content

Commit

Permalink
sharedlib
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorpela committed Jan 20, 2024
1 parent 5d7c2e6 commit 58e4dc5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/pabot/pabotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 58e4dc5

Please sign in to comment.