示例#1
0
    def __init__(
      self, libraries, host='127.0.0.1', port=8270, port_file=None,
      allow_stop=True, allow_import=None,
      register_keywords=True, introspection=True,
      ):
        """Takes a sequence of Test Library names to import,
           RobotRemoteServer's additional __init__ options
           and these optional extra args:

        :param allow_import: Sequence of Test Library names
          allowed for keyword `Import Remote Library`.
        :param register_keywords: Register imported Test Library Keywords
          directly as remote methods besides Dynamic Robot API methods?
        :param introspection: Call
          SimpleXMLRPCServer.register_introspection_functions()?
        """
        TestRobot.__init__(self, name='Remote', BuiltIn=False)
        TestLibrary.__init__(self)
        self.register_keywords = bool(register_keywords)
        self.introspection = bool(introspection)
        for lib in libraries:
            self.Import(lib)
        self.allow_import = list(allow_import or [])
        # Initialize the RobotRemoteServer base
        # with a .library.RemoteLibrary proxy
        # (RobotRemoteServer only accepts a single library instance)
        RobotRemoteServer.__init__(
          self, RemoteLibrary(robot=self),
          host, port, port_file, allow_stop)
示例#2
0
    def __init__(
        self,
        libraries,
        host='127.0.0.1',
        port=8270,
        port_file=None,
        allow_stop=True,
        allow_import=None,
        register_keywords=True,
        introspection=True,
    ):
        """Takes a sequence of Test Library names to import,
           RobotRemoteServer's additional __init__ options
           and these optional extra args:

        :param allow_import: Sequence of Test Library names
          allowed for keyword `Import Remote Library`.
        :param register_keywords: Register imported Test Library Keywords
          directly as remote methods besides Dynamic Robot API methods?
        :param introspection: Call
          SimpleXMLRPCServer.register_introspection_functions()?
        """
        TestRobot.__init__(self, name='Remote', BuiltIn=False)
        TestLibrary.__init__(self)
        self.register_keywords = bool(register_keywords)
        self.introspection = bool(introspection)
        for lib in libraries:
            self.Import(lib)
        self.allow_import = list(allow_import or [])
        # Initialize the RobotRemoteServer base
        # with a .library.RemoteLibrary proxy
        # (RobotRemoteServer only accepts a single library instance)
        RobotRemoteServer.__init__(self, RemoteLibrary(robot=self), host, port,
                                   port_file, allow_stop)
    def __init__(self):
        if not self.magic_name:
            self.magic_name = type(self).__name__

        from . import robot_shell

        if not robot_shell:
            raise RuntimeError("robotshell is not running.")
        self.robot_shell = robot_shell
        TestRobot.__init__(self, self.magic_name, variable_getters=[robot_shell.shell_variable])
示例#4
0
    def __init__(self):
        if not self.magic_name:
            self.magic_name = type(self).__name__

        from . import robot_shell
        if not robot_shell:
            raise RuntimeError("robotshell is not running.")
        self.robot_shell = robot_shell
        TestRobot.__init__(self,
                           self.magic_name,
                           variable_getters=[robot_shell.shell_variable])
示例#5
0
    def Robot(self, name=None, extname=None):
        if name and (not self.robot or name != self.robot.name):
            try:
                robot = self.robots[name]
            except KeyError:
                robot = TestRobot(name, variable_getters=[self.shell_variable])
                self.robots[name] = robot
            self.robot = robot

            robot_magic = RobotMagic(name, robot_shell=self)
            self.line_magics[str(robot_magic)] = robot_magic

            self.unregister_robot_magics()
            self.register_robot_variable_magics()
            for alias, lib in robot._libraries.items():
                self.register_robot_keyword_magics(alias, lib)

        if self.robot is None:
            label = self.robot_magic_name
        else:
            try:
                label = self.robot.magic_name
            except AttributeError:
                label = '%s.%s' % (self.robot_magic_name, name)
            else:
                if extname:
                    label += '.' + extname
        self.label = label

        return self.robot
def robot_Remote(request):
    """Creates a ``TestRobot`` instance loading ``Remote`` library,
    which automatically connects to the external ``RemoteRobot`` instance
    created in ``process`` fixture.
    """
    # make 3 connection attempts before bailing out
    for _ in range(3):
        try:
            # BuiltIn will also be served by RemoteRobot
            robot = TestRobot('Test', BuiltIn=False)
            robot.Import('Remote')
            return robot

        except DataError:
            continue
    raise
示例#7
0
 def __getattr__(self, name):
     try:
         return TestRobot.__getattr__(self, name)
     except AttributeError:
         return TestLibrary.__getattr__(self, name)
示例#8
0
 def __dir__(self):
     return TestRobot.__dir__(self) + TestLibrary.__dir__(self)
def robot(request, stdlibname):
    robot = TestRobot('Test')
    robot.Import(stdlibname)
    return robot
def robot_no_BuiltIn(request, stdlibname):
    robot = TestRobot('Test', BuiltIn=False)
    robot.Import(stdlibname)
    return robot
 def test_ImportRemoteLibrary(self, process, robot_Remote):
     assert not hasattr(robot_Remote, 'CopyList')
     robot_Remote.ImportRemoteLibrary('Collections')
     robot = TestRobot('New')
     robot.Import('Remote')
     assert robot.CopyList
示例#12
0
 def __getattr__(self, name):
     try:
         return TestRobot.__getattr__(self, name)
     except AttributeError:
         return TestLibrary.__getattr__(self, name)
示例#13
0
 def __dir__(self):
     return TestRobot.__dir__(self) + TestLibrary.__dir__(self)