From 71bb73a410786f13d883eb8a8a3179ce093259b7 Mon Sep 17 00:00:00 2001 From: Andrey Berezin Date: Tue, 5 Dec 2023 11:33:59 +0300 Subject: [PATCH] [#165] Fix test flow in case of skipped tests Signed-off-by: Andrey Berezin --- pytest_tests/testsuites/conftest.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pytest_tests/testsuites/conftest.py b/pytest_tests/testsuites/conftest.py index 0ea2e72..8dbe6fa 100644 --- a/pytest_tests/testsuites/conftest.py +++ b/pytest_tests/testsuites/conftest.py @@ -69,6 +69,7 @@ def pytest_collection_finish(session: pytest.Session): for number, item in enumerate(session.items, 1): item.stash[number_key] = f"[{number}/{items_total}]" item.stash[test_outcome] = "" + item.stash[start_time] = 0 # pytest hook. Do not rename @@ -80,7 +81,11 @@ def pytest_runtest_setup(item: pytest.Item): # pytest hook. Do not rename def pytest_runtest_makereport(item: pytest.Item, call: pytest.CallInfo): 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": duration = int(datetime.now().timestamp()) - item.stash[start_time]