diff --git a/pytest.ini b/pytest.ini index 812063e54..eda54aa56 100644 --- a/pytest.ini +++ b/pytest.ini @@ -17,6 +17,7 @@ markers = 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 + qtwebkit_skip: Tests not applicable with QtWebKit qt_log_level_fail = WARNING qt_log_ignore = ^SpellCheck: .* diff --git a/tests/conftest.py b/tests/conftest.py index b04698dbe..c0493bbf5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -226,11 +226,12 @@ if not getattr(sys, 'frozen', False): else: raise ValueError("Invalid package {!r}".format(package)) - def _get_qtwebengine_tag(tag): - """Handle a @qtwebengine_* tag.""" + def _get_backend_tag(tag): + """Handle a @qtwebengine_*/@qtwebkit_skip tag.""" pytest_marks = { 'qtwebengine_todo': pytest.mark.qtwebengine_todo, 'qtwebengine_skip': pytest.mark.qtwebengine_skip, + 'qtwebkit_skip': pytest.mark.qtwebkit_skip } if not any(tag.startswith(t + ':') for t in pytest_marks): return None @@ -243,7 +244,7 @@ if not getattr(sys, 'frozen', False): This tries various functions, and if none knows how to handle this tag, it returns None so it falls back to pytest-bdd's implementation. """ - funcs = [_get_version_tag, _get_qtwebengine_tag] + funcs = [_get_version_tag, _get_backend_tag] for func in funcs: mark = func(tag) if mark is not None: diff --git a/tests/end2end/features/conftest.py b/tests/end2end/features/conftest.py index 5738531fa..75e463689 100644 --- a/tests/end2end/features/conftest.py +++ b/tests/end2end/features/conftest.py @@ -39,19 +39,22 @@ def pytest_collection_modifyitems(config, items): webengine = config.getoption('--qute-bdd-webengine') markers = { - 'qtwebengine_todo': ('QtWebEngine TODO', pytest.mark.xfail), - 'qtwebengine_skip': ('Skipped with QtWebEngine', pytest.mark.skipif), + 'qtwebengine_todo': ('QtWebEngine TODO', pytest.mark.xfail, webengine), + 'qtwebengine_skip': ('Skipped with QtWebEngine', pytest.mark.skipif, + webengine), + 'qtwebkit_skip': ('Skipped with QtWebKit', pytest.mark.skipif, + not webengine), } for item in items: - for name, (prefix, pytest_mark) in markers.items(): + for name, (prefix, pytest_mark, condition) 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, + item.add_marker(pytest_mark(condition, reason=text, **marker.kwargs))