sanitycheck: do not duplicate code in tests
Fixed tests to use library code instead of duplicating logic in the test itself. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
9e1be4c05e
commit
1c2f127e3f
2 changed files with 2 additions and 13 deletions
|
@ -3204,6 +3204,7 @@ class TestSuite(DisablePyTestCollectionMixin):
|
|||
with open(filename, 'wb') as report:
|
||||
report.write(result)
|
||||
|
||||
return fails, passes, errors, skips
|
||||
|
||||
def csv_report(self, filename):
|
||||
with open(filename, "wt") as csvfile:
|
||||
|
|
|
@ -99,24 +99,12 @@ def test_xunit_report(class_testsuite, test_data,
|
|||
inst2.status = "skipped"
|
||||
|
||||
filename = test_data + "sanitycheck.xml"
|
||||
class_testsuite.xunit_report(filename)
|
||||
fails, passes, errors, skips = class_testsuite.xunit_report(filename)
|
||||
assert os.path.exists(filename)
|
||||
|
||||
filesize = os.path.getsize(filename)
|
||||
assert filesize != 0
|
||||
|
||||
fails, passes, errors, skips = 0, 0, 0, 0
|
||||
for instance in class_testsuite.instances.values():
|
||||
if instance.status in ["failed", "timeout"]:
|
||||
if instance.reason in ['build_error', 'handler_crash']:
|
||||
errors += 1
|
||||
else:
|
||||
fails += 1
|
||||
elif instance.status == 'skipped':
|
||||
skips += 1
|
||||
else:
|
||||
passes += 1
|
||||
|
||||
tree = ET.parse(filename)
|
||||
assert int(tree.findall('testsuite')[0].attrib["skip"]) == int(skips)
|
||||
assert int(tree.findall('testsuite')[0].attrib["failures"]) == int(fails)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue