def visit_test(self, test): test_json = { "Suite Name": test.parent, "Test Name": test, "Test Id": test.id, "Status": test.status, "Documentation": html_format(test.doc), "Time": test.elapsedtime, "Message": html_format(test.message), "Tags": test.tags } self.test_list.append(test_json)
def assert_escape_and_format(inp, exp_escape=None, exp_format=None): if exp_escape is None: exp_escape = str(inp) if exp_format is None: exp_format = exp_escape exp_format = '<p>%s</p>' % exp_format.replace('\n', ' ') escape = html_escape(inp) format = html_format(inp) assert_equals(escape, exp_escape, 'ESCAPE:\n%r =!\n%r' % (escape, exp_escape), values=False) assert_equals(format, exp_format, 'FORMAT:\n%r =!\n%r' % (format, exp_format), values=False)
def start_suite(self, suite): if suite.tests: try: stats = suite.statistics.all except: stats = suite.statistics try: skipped = stats.skipped except: skipped = 0 suite_json = { "Name": suite.longname, "Id": suite.id, "Status": suite.status, "Documentation": html_format(suite.doc), "Total": stats.total, "Pass": stats.passed, "Fail": stats.failed, "Skip": skipped, "Time": suite.elapsedtime, } self.suite_list.append(suite_json)
def assert_format(inp, exp=None, p=False): exp = exp if exp is not None else inp if p: exp = '<p>%s</p>' % exp assert_equals(html_format(inp), exp)
def assert_format(inp, exp=None, p=False): exp = exp if exp is not None else inp if p: exp = '<p>%s</p>' % exp assert_equal(html_format(inp), exp)