def _is_in_incl_suites(self, name, include_suites): if include_suites == []: return True # Match only to the last part of name given like '--suite parent.child' include_suites = [incl.split(".")[-1] for incl in include_suites] name = name.split("__", 1)[-1] # Strip possible prefix return utils.matches_any(name, include_suites, ignore=["_"])
def _is_in_incl_suites(self, name, include_suites): if include_suites == []: return True # Match only to the last part of name given like '--suite parent.child' include_suites = [ incl.split('.')[-1] for incl in include_suites ] name = name.split('__', 1)[-1] # Strip possible prefix return utils.matches_any(name, include_suites, ignore=['_'])
def test_exclude(self): for excl, tags in _incl_excl_data: tagstats = TagStatistics([], excl) tagstats.add_test(TestMock('PASS', tags), _Critical()) exp_keys = [tag for tag in sorted(tags) if not utils.matches_any(tag, excl)] assert_equal(sorted(tagstats.stats.keys()), exp_keys, "Excls: %s" % excl)
def test_exclude(self): for excl, tags in _incl_excl_data: tagstats = TagStatistics([], excl) tagstats.add_test(TestMock('PASS', tags), _Critical()) exp_keys = [ tag for tag in sorted(tags) if not utils.matches_any(tag, excl) ] assert_equal(sorted(tagstats.stats.keys()), exp_keys, "Excls: %s" % excl)
def _filter_by_names(self, suites, tests): suites = self._filter_suite_names(suites) self.suites = [ suite for suite in self.suites if suite._filter_by_names(suites, tests) ] if not suites: self.tests = [ test for test in self.tests if tests == [] or utils.matches_any(test.name, tests, ignore=['_']) ] else: self.tests = [] return self.suites or self.tests
def tag(self, stats): if utils.matches_any(stats[0].name, self._tags): line = {'linestyle': '-', 'linewidth': 0.3} mark = {'marker': self._get_marker(), 'markersize': self._marker_size} self._plot(self._indexes, stats, **line) markers = [stats[index] for index in self._xticks] self._plot(self._xticks, markers, linestyle='', **mark) line.update(mark) label = self._get_tag_label(stats) self._legends.append(Legend(label=label, **line))
def test_include(self): for incl, tags in _incl_excl_data: tagstats = TagStatistics(incl, []) tagstats.add_test(TestMock('PASS', tags), _Critical()) keys = tagstats.stats.keys() keys.sort() tags.sort() exp_keys = [ tag for tag in tags if incl == [] or utils.matches_any(tag, incl) ] assert_equal(keys, exp_keys, "Incls: %s " % incl)
def tag(self, stats): if utils.matches_any(stats[0].name, self._tags): line = {'linestyle': '-', 'linewidth': 0.3} mark = { 'marker': self._get_marker(), 'markersize': self._marker_size } self._plot(self._indexes, stats, **line) markers = [stats[index] for index in self._xticks] self._plot(self._xticks, markers, linestyle='', **mark) line.update(mark) label = self._get_tag_label(stats) self._legends.append(Legend(label=label, **line))
def _is_included(self, tag): if self._include and not utils.matches_any(tag, self._include): return False return not utils.matches_any(tag, self._exclude)
def is_non_critical(self, tag): return utils.matches_any(tag, self.nons)
def is_critical(self, tag): return utils.matches_any(tag, self.tags)
def _is_included(self, tag): if self._include != [] and not utils.matches_any(tag, self._include): return False return not utils.matches_any(tag, self._exclude)