From ab1e91592ef48bfe149d0fcaf680da3dd39e824f Mon Sep 17 00:00:00 2001 From: Pavel Merzlyakov Date: Fri, 16 Nov 2018 20:47:14 +0200 Subject: [PATCH] fix invalid order (or unknown duration) of skipped or failed (in SetUp) testcase --- allure-pytest/src/listener.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/allure-pytest/src/listener.py b/allure-pytest/src/listener.py index 894b57a2..4bc4869c 100644 --- a/allure-pytest/src/listener.py +++ b/allure-pytest/src/listener.py @@ -83,19 +83,14 @@ def pytest_runtest_setup(self, item): test_result.historyId = md5(test_result.fullName) test_result.parameters.extend( [Parameter(name=name, value=represent(value)) for name, value in params.items()]) + test_result.start = now() @pytest.hookimpl(hookwrapper=True) - def pytest_runtest_call(self, item): + def pytest_runtest_teardown(self, item): uuid = self._cache.get(item.nodeid) test_result = self.allure_logger.get_test(uuid) - if test_result: - test_result.start = now() - yield - if test_result: - test_result.stop = now() + test_result.stop = now() - @pytest.hookimpl(hookwrapper=True) - def pytest_runtest_teardown(self, item): yield uuid = self._cache.get(item.nodeid) test_result = self.allure_logger.get_test(uuid)