From c3a7dd00239d4caece85fce98576ff8efdc11117 Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Tue, 26 Apr 2022 08:03:28 +0200 Subject: [PATCH] e2e: rebae conftest --- test/appium/tests/conftest.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test/appium/tests/conftest.py b/test/appium/tests/conftest.py index 53b064de01..c93aefcbd5 100644 --- a/test/appium/tests/conftest.py +++ b/test/appium/tests/conftest.py @@ -216,6 +216,16 @@ def should_save_device_stats(config): def pytest_runtest_makereport(item, call): outcome = yield report = outcome.get_result() + if "xdist_group" in item.keywords._markers and report.when == "setup" and report.failed: + test_suite_data.set_current_test(item.name, testrail_case_id=get_testrail_case_id(item)) + test_suite_data.current_test.create_new_testrun() + test_suite_data.current_test.group_name = item.instance.__class__.__name__ + error = report.longreprtext + exception = re.findall('E.*Message:|E.*Error:|E.*Failed:', error) + if exception: + error = error.replace(re.findall('E.*Message:|E.*Error:|E.*Failed:', report.longreprtext)[0], '') + test_suite_data.current_test.testruns[-1].error = "Test setup failed: \n" + error + github_report.save_test(test_suite_data.current_test) if report.when == 'call': is_sauce_env = item.config.getoption('env') == 'sauce' current_test = test_suite_data.current_test @@ -282,8 +292,9 @@ def pytest_runtest_protocol(item, nextitem): for i in range(rerun_count): reports = runtestprotocol(item, nextitem=nextitem) for report in reports: - is_in_group = [i for i in item.iter_markers(name='xdist_group')] - if report.failed and should_rerun_test(report.longreprtext) and not is_in_group: + if report.failed and should_rerun_test(report.longreprtext): + # is_in_group = [i for i in item.iter_markers(name='xdist_group')] + # if report.failed and should_rerun_test(report.longreprtext): break # rerun else: return True # no need to rerun