forked from TrueCloudLab/frostfs-testcases
[#165] Fix test flow in case of skipped tests
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
parent
f6438c5b93
commit
71bb73a410
1 changed files with 6 additions and 1 deletions
|
@ -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]
|
||||||
|
|
Loading…
Reference in a new issue