Robot Framework Integrated Development Environment (RIDE)
configurer.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 from robotide.lib.robot import model
17 from robotide.lib.robot.utils import is_string, secs_to_timestamp, timestamp_to_secs
18 
19 
20 
33 
34  def __init__(self, remove_keywords=None, log_level=None, start_time=None,
35  end_time=None, critical_tags=None, non_critical_tags=None,
36  **base_config):
37  model.SuiteConfigurer.__init__(self, **base_config)
38  self.remove_keywordsremove_keywords = self._get_remove_keywords_get_remove_keywords(remove_keywords)
39  self.log_levellog_level = log_level
40  self.start_timestart_time = self._get_time_get_time(start_time)
41  self.end_timeend_time = self._get_time_get_time(end_time)
42  self.critical_tagscritical_tags = critical_tags
43  self.non_critical_tagsnon_critical_tags = non_critical_tags
44 
45  def _get_remove_keywords(self, value):
46  if value is None:
47  return []
48  if is_string(value):
49  return [value]
50  return value
51 
52  def _get_time(self, timestamp):
53  if not timestamp:
54  return None
55  try:
56  secs = timestamp_to_secs(timestamp, seps=' :.-_')
57  except ValueError:
58  return None
59  return secs_to_timestamp(secs, millis=True)
60 
61  def visit_suite(self, suite):
62  model.SuiteConfigurer.visit_suite(self, suite)
63  self._remove_keywords_remove_keywords(suite)
64  self._set_times_set_times(suite)
65  suite.filter_messages(self.log_levellog_level)
66  suite.set_criticality(self.critical_tagscritical_tags, self.non_critical_tagsnon_critical_tags)
67 
68  def _remove_keywords(self, suite):
69  for how in self.remove_keywordsremove_keywords:
70  suite.remove_keywords(how)
71 
72  def _set_times(self, suite):
73  if self.start_timestart_time:
74  suite.starttime = self.start_timestart_time
75  if self.end_timeend_time:
76  suite.endtime = self.end_timeend_time
def visit_suite(self, suite)
Implements traversing through the suite and its direct children.
Definition: configurer.py:61
def __init__(self, remove_keywords=None, log_level=None, start_time=None, end_time=None, critical_tags=None, non_critical_tags=None, **base_config)
Definition: configurer.py:36
def secs_to_timestamp(secs, seps=None, millis=False)
Definition: robottime.py:309
def timestamp_to_secs(timestamp, seps=None)
Definition: robottime.py:300