Exemple #1
0
    def _send_pid(self):
        self._send_socket("start agent", "")
        self._send_socket("pid", os.getpid())
        variables = {}
        try:
            try:
                from robot.variables import GLOBAL_VARIABLES
                variables = GLOBAL_VARIABLES
            except ImportError:  # for robot >2.9
                from robot.conf.settings import RobotSettings
                from robot.variables.scopes import GlobalVariables
                variables = GlobalVariables(RobotSettings()).as_dict()

            data = {}
            for k in variables.keys():
                if not (k.startswith('${') or k.startswith('@{')):
                    key = '${' + k + '}'
                else:
                    key = k
                data[key] = str(variables[k])
            self._send_socket('global_vars', 'global_vars', data)
        except Exception as e:
            self.print_error_message(
                'Global variables sending error: ' + str(e) + ' Global variables: ' + str(variables))
            pass
Exemple #2
0
    def _send_pid(self):
        self._send_socket("start agent", "")
        self._send_socket("pid", os.getpid())
        variables = {}
        try:
            try:
                from robot.variables import GLOBAL_VARIABLES
                variables = GLOBAL_VARIABLES
            except ImportError:  # for robot >2.9
                from robot.conf.settings import RobotSettings
                from robot.variables.scopes import GlobalVariables
                variables = GlobalVariables(RobotSettings()).as_dict()

            data = {}
            for k in variables.keys():
                if not (k.startswith('${') or k.startswith('@{')):
                    key = '${' + k + '}'
                else:
                    key = k
                data[key] = str(variables[k])
            self._send_socket('global_vars', 'global_vars', data)
        except Exception as e:
            self.print_error_message(
                'Global variables sending error: ' + str(e) + ' Global variables: ' + str(variables))
            pass
    def _send_global_variables(self):
        variables = {}
        try:
            try:
                from robot.variables import GLOBAL_VARIABLES
                variables = GLOBAL_VARIABLES
            except ImportError:  # for robot >2.9
                from robot.conf.settings import RobotSettings
                from robot.variables.scopes import GlobalVariables
                variables = GlobalVariables(RobotSettings()).as_dict()

            data = {}
            for key in variables.keys():
                new_key = '${' + key + '}' if not key.startswith(
                    '${') and not key.startswith('@{') else key
                data[new_key] = str(variables[key])
            self._send_to_server('global_vars', 'global_vars', data)
        except Exception as e:
            self._print_error_message('Global variables sending error: ' +
                                      str(e) + ' Global variables: ' +
                                      str(variables))