Beispiel #1
0
    def check_suite_contains_tests(self, suite, *expected_names, **statuses):
        actual_tests = [test for test in self.get_tests_from_suite(suite)]
        tests_msg = """
Expected tests : %s
Actual tests   : %s""" % (str(list(expected_names)), str(actual_tests))
        expected_names = [utils.normalize(name) for name in expected_names]
        statuses = dict((utils.normalize(k), v) for k, v in statuses.items())
        if len(actual_tests) != len(expected_names):
            raise AssertionError("Wrong number of tests." + tests_msg)
        for test in actual_tests:
            norm_name = utils.normalize(test.name)
            if utils.MultiMatcher(expected_names).match(test.name):
                print("Verifying test '%s'" % test.name)
                status = statuses.get(norm_name)
                if status and ':' in status:
                    status, message = status.split(':', 1)
                else:
                    message = None
                self.check_test_status(test, status, message)
                expected_names.remove(norm_name)
            else:
                raise AssertionError(
                    "Test '%s' was not expected to be run.%s" %
                    (test.name, tests_msg))
        assert not expected_names
 def filter_by_names(self, suites=None, tests=None, zero_tests_ok=False):
     suites = [([], name.split('.')) for name in suites or []]
     tests = utils.MultiMatcher(tests,
                                ignore=['_'],
                                match_if_no_patterns=True)
     if not self._filter_by_names(suites, tests) and not zero_tests_ok:
         self._raise_no_tests_filtered_by_names(suites, tests)
Beispiel #3
0
 def tag(self, stats):
     if utils.MultiMatcher(self._tags).match(stats[0].name):
         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))
Beispiel #4
0
    def check_suite_contains_tests(self, suite, *expected_names):
        actual_tests = [test for test in self.get_tests_from_suite(suite)]
        tests_msg = """
Expected tests : %s
Actual tests   : %s""" % (str(list(expected_names)), str(actual_tests))
        expected_names = [utils.normalize(name) for name in expected_names]
        if len(actual_tests) != len(expected_names):
            raise AssertionError("Wrong number of tests." + tests_msg)
        for test in actual_tests:
            if utils.MultiMatcher(expected_names).match(test.name):
                print "Verifying test '%s'" % test.name
                self.check_test_status(test)
                expected_names.remove(utils.normalize(test.name))
            else:
                raise AssertionError(
                    "Test '%s' was not expected to be run.%s" %
                    (test.name, tests_msg))
        assert not expected_names
Beispiel #5
0
 def _get_tags(self, tags):
     if isinstance(tags, utils.MultiMatcher):
         return tags
     return utils.MultiMatcher(utils.normalize_tags(tags or []), ignore=['_'])