def test_testlibrary(): """Test creation of Dynamic Test Library classes. """ TestLibrary = testlibrary() assert istestlibraryclass(TestLibrary) assert not TestLibrary.session_handlers assert not TestLibrary.context_handlers assert not TestLibrary.keywords @TestLibrary.keyword def test_keyword(self): pass class LibraryNotCallingBaseInit(TestLibrary): def __init__(self): pass assert istestlibraryclass(LibraryNotCallingBaseInit) lib = LibraryNotCallingBaseInit() # check if methods complain about missing instance-bound keywords mapping for method, args in [ (lib.get_keyword_names, []), (lib.get_keyword_arguments, ['test_keyword']), (lib.get_keyword_documentation, ['test_keyword']), (lib.run_keyword, ['test_keyword', []]), ]: with pytest.raises(RuntimeError) as e: method(*args) assert str(e.value).strip().endswith('base __init__ called?')
__all__ = ['RemoteRobot'] from robottools import __version__, __requires__, __extras__ __requires__ += __extras__['remote'].checked del __extras__ from robotremoteserver import RobotRemoteServer from robottools import TestRobot, TestLibraryInspector, testlibrary from robottools.testrobot import Keyword from .library import RemoteLibrary # Additional base for RemoteRobot, to handle its own Keywords: TestLibrary = testlibrary() keyword = TestLibrary.keyword # register basic 'Stop Remote Server' as RemoteRobot keyword keyword(RobotRemoteServer.stop_remote_server) class RemoteRobot(TestRobot, RobotRemoteServer, TestLibrary): """Makes Test Libraries remotely accessible via XML-RPC. - Can handle multiple Test Libraries. - Usable with Robot Framework's standard 'Remote' Library. """ def __init__( self, libraries,
from moretools import boolclass, isboolclass, isstring import robot.running from robot.running.namespace import IMPORTER from robot.parsing.settings import Library as LibrarySetting from robot.utils import NormalizedDict, normalize from robot.libraries.BuiltIn import BuiltIn from robottools import testlibrary, normboolclass, RobotBool BUILTIN = BuiltIn() TestLibrary = testlibrary() keyword = TestLibrary.keyword class ToolsLibrary(TestLibrary): ROBOT_LIBRARY_VERSION = __version__ ROBOT_LIBRARY_SCOPE = 'GLOBAL' @keyword def reload_library(self, name, *args): """Reload an already imported Test Library with given `name` and optional `args`. This also leads to a reload of the Test Library Keywords,