def _link_keywords(self, res):
     name = res.group(1)
     lib = self.lib if hasattr(self, 'lib') else self
     for kw in lib.keywords:
         if utils.eq(name, kw.name):
             return '<a href="#%s" class="name">%s</a>' % (kw.name, name)
     if utils.eq_any(name, ['introduction', 'library introduction']):
         return '<a href="#introduction" class="name">%s</a>' % name
     if utils.eq_any(name, ['importing', 'library importing']):
         return '<a href="#importing" class="name">%s</a>' % name
     return '<span class="name">%s</span>' % name
예제 #2
0
 def _link_keywords(self, res):
     name = res.group(1)
     lib = self.lib if hasattr(self, 'lib') else self
     for kw in lib.keywords:
         if utils.eq(name, kw.name):
             return '<a href="#%s" class="name">%s</a>' % (kw.name, name)
     if utils.eq_any(name, ['introduction', 'library introduction']):
         return '<a href="#introduction" class="name">%s</a>' % name
     if utils.eq_any(name, ['importing', 'library importing']):
         return '<a href="#importing" class="name">%s</a>' % name
     return '<span class="name">%s</span>' % name
예제 #3
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.eq_any(test.name, expected_names):
                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))
        if len(expected_names) != 0:
            raise Exception("Bug in test library")