Esempio n. 1
0
 def start_suite(self, suite):
     variables = GLOBAL_VARIABLES.copy()
     variables.set_from_variable_table(suite.variables)
     result = TestSuite(source=suite.source,
                        name=suite.name,
                        doc=suite.doc,
                        metadata=suite.metadata,
                        starttime=get_timestamp())
     if not self.result:
         result.set_criticality(self._settings.critical_tags,
                                self._settings.non_critical_tags)
         self.result = Result(root_suite=result)
         self.result.configure(status_rc=self._settings.status_rc,
                               stat_config=self._settings.statistics_config)
     else:
         self._suite.suites.append(result)
     ns = Namespace(result, variables, self._variables,
                    suite.user_keywords, suite.imports)
     EXECUTION_CONTEXTS.start_suite(ns, self._output, self._settings.dry_run)
     self._context.set_suite_variables(result)
     if not (self._suite_status and self._suite_status.failures):
         ns.handle_imports()
     variables.resolve_delayed()
     result.doc = self._resolve_setting(result.doc)
     result.metadata = [(self._resolve_setting(n), self._resolve_setting(v))
                        for n, v in result.metadata.items()]
     self._context.set_suite_variables(result)
     self._suite = result
     self._suite_status = SuiteStatus(self._suite_status,
                                      self._settings.exit_on_failure,
                                      self._settings.skip_teardown_on_exit)
     self._output.start_suite(ModelCombiner(suite, self._suite))
     self._run_setup(suite.keywords.setup, self._suite_status)
     self._executed_tests = NormalizedDict(ignore='_')
Esempio n. 2
0
 def start_suite(self, suite):
     variables = GLOBAL_VARIABLES.copy()
     variables.set_from_variable_table(suite.variables)
     result = TestSuite(source=suite.source,
                        name=suite.name,
                        doc=suite.doc,
                        metadata=suite.metadata,
                        starttime=get_timestamp())
     if not self.result:
         result.set_criticality(self._settings.critical_tags,
                                self._settings.non_critical_tags)
         self.result = Result(root_suite=result)
         self.result.configure(status_rc=self._settings.status_rc,
                               stat_config=self._settings.statistics_config)
     else:
         self._suite.suites.append(result)
     ns = Namespace(result, variables, self._variables, suite.user_keywords,
                    suite.imports)
     EXECUTION_CONTEXTS.start_suite(ns, self._output,
                                    self._settings.dry_run)
     self._context.set_suite_variables(result)
     if not (self._suite_status and self._suite_status.failures):
         ns.handle_imports()
     variables.resolve_delayed()
     result.doc = self._resolve_setting(result.doc)
     result.metadata = [(self._resolve_setting(n), self._resolve_setting(v))
                        for n, v in result.metadata.items()]
     self._context.set_suite_variables(result)
     self._suite = result
     self._suite_status = SuiteStatus(self._suite_status,
                                      self._settings.exit_on_failure,
                                      self._settings.skip_teardown_on_exit)
     self._output.start_suite(ModelCombiner(suite, self._suite))
     self._run_setup(suite.keywords.setup, self._suite_status)
     self._executed_tests = NormalizedDict(ignore='_')
Esempio n. 3
0
 def __init__(self):
     variables = GLOBAL_VARIABLES.copy()
     self._suite = self.current = variables
     self._test = None
     self._uk_handlers = []    # FIXME: Better name
     self._set_test_vars = Varz()
     self._set_kw_vars = Varz()
Esempio n. 4
0
 def __init__(self,
              data,
              parent=None,
              defaults=None,
              process_variables=True):
     BaseTestSuite.__init__(self, data.name, data.source, parent)
     self.variables = GLOBAL_VARIABLES.copy()
     if process_variables:
         self.variables.set_from_variable_table(data.variable_table)
     self.source = data.source
     self.doc = data.setting_table.doc.value
     self.metadata = self._get_metadata(data.setting_table.metadata)
     self.imports = data.imports
     self.user_keywords = UserLibrary(data.keywords)
     self.setup = Setup(data.setting_table.suite_setup.name,
                        data.setting_table.suite_setup.args)
     self.teardown = Teardown(data.setting_table.suite_teardown.name,
                              data.setting_table.suite_teardown.args)
     defaults = DefaultValues(data.setting_table, defaults)
     for suite in data.children:
         RunnableTestSuite(suite, self, defaults, process_variables)
     for test in data.testcase_table:
         RunnableTestCase(test, self, defaults)
     self._exit_on_failure_mode = False
     self._skip_teardowns_on_exit_mode = False
     self._dry_run_mode = False
Esempio n. 5
0
File: model.py Progetto: nbbull/RIDE
 def __init__(self, suitedatas):
     BaseTestSuite.__init__(self, name="")
     self.variables = GLOBAL_VARIABLES.copy()
     self.doc = ""
     self.imports = []
     self.setup = Setup(None, None)
     self.teardown = Teardown(None, None)
     for suite in suitedatas:
         RunnableTestSuite(suite, parent=self)
     self._run_mode_exit_on_failure = False
     self._run_mode_dry_run = False
     self._run_mode_skip_teardowns_on_exit = False
Esempio n. 6
0
 def __init__(self, suitedatas, process_variables=True):
     BaseTestSuite.__init__(self, name='')
     self.variables = GLOBAL_VARIABLES.copy()
     self.doc = ''
     self.imports = []
     self.setup = Setup(None, None)
     self.teardown = Teardown(None, None)
     for suite in suitedatas:
         RunnableTestSuite(suite, self, process_variables=process_variables)
     self._exit_on_failure_mode = False
     self._skip_teardowns_on_exit_mode = False
     self._dry_run_mode = False
Esempio n. 7
0
 def __init__(self, suitedatas):
     BaseTestSuite.__init__(self, name='')
     self.variables = GLOBAL_VARIABLES.copy()
     self.doc = ''
     self.imports = []
     self.setup = Setup(None, None)
     self.teardown = Teardown(None, None)
     for suite in suitedatas:
         RunnableTestSuite(suite, parent=self)
     self._exit_on_failure_mode = False
     self._skip_teardowns_on_exit_mode = False
     self._dry_run_mode = False
    def __init__(self, name, BuiltIn=True, variable_getters=None):
        """Initialize with a `name`
           and optional additional variable lookup functions.

        - If a Variable is not found in the Robot's Variables dictionary,
          the `variable_getters` will be called in the given order
          with the Variable string in Robot syntax ($/@{...})
          until no `LookupError` or `DataError` is raised.
          (Used by the `robot_shell` to extend Variables lookup
           to IPython's `user_ns` and Python's `builtins`).

        :param BuiltIn: Import RFW's BuiltIn Library by default?
        :param variable_getters: A sequence of callables.
        """
        self.name = name
        self.debug = False
        try:
            GLOBAL_VARIABLES
        except NameError:
            # Robot 2.9+
            self._variables = VariableScopes(RobotSettings())
        else:
            # Robot 2.8
            if not GLOBAL_VARIABLES: # HACK
                init_global_variables(RobotSettings())
            self._variables = GLOBAL_VARIABLES.copy()
        # HACK even more to extend variable lookup
        self._variables.__class__ = variablesclass(
            self._variables.__class__, extra_getters=variable_getters)

        self._output = Output()
        self._context = Context(testrobot=self)
        self._suite = TestSuite(name)

        argspec = getargspec(Namespace.__init__)
        namespace = partial(
            Namespace, suite=self._suite, variables=self._variables)
        if 'resource' in argspec.args:
            # Robot 3.0
            self._namespace = namespace(resource=self._suite.resource)
        else:
            namespace.keywords.update(user_keywords=[], imports=None)
            if 'parent_variables' in argspec.args:
                # Robot 2.8
                self._namespace = namespace(parent_variables=None)
            else:
                # Robot 2.9
                self._namespace = namespace()

        if BuiltIn:
            self.Import('BuiltIn')
Esempio n. 9
0
File: model.py Progetto: nbbull/RIDE
 def __init__(self, data, parent=None, defaults=None):
     BaseTestSuite.__init__(self, data.name, data.source, parent)
     self.variables = GLOBAL_VARIABLES.copy()
     self.variables.set_from_variable_table(data.variable_table)
     self.source = data.source
     self.doc = data.setting_table.doc.value
     self.metadata = self._get_metadata(data.setting_table.metadata)
     self.imports = data.imports
     self.user_keywords = UserLibrary(data.keywords)
     self.setup = Setup(data.setting_table.suite_setup.name, data.setting_table.suite_setup.args)
     self.teardown = Teardown(data.setting_table.suite_teardown.name, data.setting_table.suite_teardown.args)
     defaults = DefaultValues(data.setting_table, defaults)
     for suite in data.children:
         RunnableTestSuite(suite, parent=self, defaults=defaults)
     for test in data.testcase_table:
         RunnableTestCase(test, parent=self, defaults=defaults)
     self._run_mode_exit_on_failure = False
     self._run_mode_dry_run = False
     self._run_mode_skip_teardowns_on_exit = False
Esempio n. 10
0
 def set_global(self, name, value):
     GLOBAL_VARIABLES.__setitem__(name, value, depr_warning=False)
     for ns in robot.running.NAMESPACES:
         ns.variables.set_suite(name, value)
Esempio n. 11
0
 def set_global(self, name, value):
     GLOBAL_VARIABLES.__setitem__(name, value)
     for ns in EXECUTION_CONTEXTS.namespaces:
         ns.variables.set_suite(name, value)
 def set_global(self, name, value):
     GLOBAL_VARIABLES.__setitem__(name, value)
     for ns in robot.running.NAMESPACES:
         ns.variables.set_suite(name, value)