Fix test flow in case of skipped tests #165

Merged
anikeev-yadro merged 1 commit from abereziny/frostfs-testcases:bugfix-fix-skipped-tests into master 2023-12-05 09:04:52 +00:00

View file

@ -69,6 +69,7 @@ def pytest_collection_finish(session: pytest.Session):
for number, item in enumerate(session.items, 1): for number, item in enumerate(session.items, 1):
item.stash[number_key] = f"[{number}/{items_total}]" item.stash[number_key] = f"[{number}/{items_total}]"
item.stash[test_outcome] = "" item.stash[test_outcome] = ""
item.stash[start_time] = 0
# pytest hook. Do not rename # pytest hook. Do not rename
@ -80,7 +81,11 @@ def pytest_runtest_setup(item: pytest.Item):
# pytest hook. Do not rename # pytest hook. Do not rename
def pytest_runtest_makereport(item: pytest.Item, call: pytest.CallInfo): def pytest_runtest_makereport(item: pytest.Item, call: pytest.CallInfo):
if call.excinfo is not None: if call.excinfo is not None:
item.stash[test_outcome] += f"FAILED on {call.when}; " if call.excinfo.typename == "Skipped":
item.stash[start_time] = int(datetime.now().timestamp())
item.stash[test_outcome] += f"SKIPPED on {call.when}; "
else:
item.stash[test_outcome] += f"FAILED on {call.when}; "
if call.when == "teardown": if call.when == "teardown":
duration = int(datetime.now().timestamp()) - item.stash[start_time] duration = int(datetime.now().timestamp()) - item.stash[start_time]