diff --git a/pytest.ini b/pytest.ini index 3c63d16f9..812063e54 100644 --- a/pytest.ini +++ b/pytest.ini @@ -16,6 +16,7 @@ markers = ci: Tests which should only run on CI. flaky_once: Try to rerun this test once if it fails qtwebengine_todo: Features still missing with QtWebEngine + qtwebengine_skip: Tests not applicable with QtWebEngine qt_log_level_fail = WARNING qt_log_ignore = ^SpellCheck: .* diff --git a/tests/end2end/features/conftest.py b/tests/end2end/features/conftest.py index 9b3e84258..97f134b64 100644 --- a/tests/end2end/features/conftest.py +++ b/tests/end2end/features/conftest.py @@ -39,11 +39,20 @@ def pytest_collection_modifyitems(config, items): """Apply @qtwebengine_* markers.""" webengine = config.getoption('--qute-bdd-webengine') + markers = { + 'qtwebengine_todo': ('QtWebEngine TODO', pytest.mark.xfail), + 'qtwebengine_skip': ('Skipped with QtWebEngine', pytest.mark.skipif), + } + for item in items: - marker = item.get_marker('qtwebengine_todo') - if marker: - text = 'QtWebEngine TODO: {}'.format(marker.args[0]) - item.add_marker(pytest.mark.skipif(webengine, reason=text)) + for name, (prefix, pytest_mark) in markers.items(): + marker = item.get_marker(name) + if marker: + if marker.args: + text = '{}: {}'.format(prefix, marker.args[0]) + else: + text = prefix + item.add_marker(pytest_mark(webengine, reason=text)) @pytest.hookimpl(hookwrapper=True)