Robot Framework Integrated Development Environment (RIDE)
criticality.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.utils import py2to3
17 
18 from .tags import TagPatterns
19 
20 
21 @py2to3
22 class Criticality():
23 
24  def __init__(self, critical_tags=None, non_critical_tags=None):
25  self.critical_tagscritical_tags = self._get_tag_patterns_get_tag_patterns(critical_tags)
26  self.non_critical_tagsnon_critical_tags = self._get_tag_patterns_get_tag_patterns(non_critical_tags)
27 
28  def _get_tag_patterns(self, tags):
29  return TagPatterns(tags) if not isinstance(tags, TagPatterns) else tags
30 
31  def tag_is_critical(self, tag):
32  return self.critical_tagscritical_tags.match(tag)
33 
34  def tag_is_non_critical(self, tag):
35  return self.non_critical_tagsnon_critical_tags.match(tag)
36 
37  def test_is_critical(self, test):
38  if self.critical_tagscritical_tags and not self.critical_tagscritical_tags.match(test.tags):
39  return False
40  return not self.non_critical_tagsnon_critical_tags.match(test.tags)
41 
42  def __nonzero__(self):
43  return bool(self.critical_tagscritical_tags or self.non_critical_tagsnon_critical_tags)
def __init__(self, critical_tags=None, non_critical_tags=None)
Definition: criticality.py:24