def test_test_times(report_for, stmt): start = time.time() report = report_for(""" def test(): %s """ % stmt) stop = time.time() assert_that(report.find('.//test-case').attrib, has_entries(start=has_float(greater_than(start * 1000)), stop=has_float(less_than(stop * 1000))))
def test_test_times(report_for, stmt): start = time.time() report = report_for(""" def test(): %s """ % stmt) stop = time.time() assert_that( report.find('.//test-case').attrib, has_entries(start=has_float(greater_than(start * 1000)), stop=has_float(less_than(stop * 1000))))
def test_suite_times(report_for): start = time.time() report = report_for(""" def test(): assert True """) stop = time.time() assert_that(report.get('start'), has_float(all_of( greater_than(start * 1000), less_than(float(report.get('stop'))) ))) assert_that(report.get('stop'), has_float(all_of( greater_than(float(report.get('start'))), less_than(stop * 1000), )))
def test_suite_times(report_for): start = time.time() report = report_for(""" def test(): assert True """) stop = time.time() assert_that( report.get('start'), has_float( all_of(greater_than(start * 1000), less_than(float(report.get('stop')))))) assert_that( report.get('stop'), has_float( all_of( greater_than(float(report.get('start'))), less_than(stop * 1000), )))