Add a @qtwebkit_skip marker
This commit is contained in:
parent
30c07e9b5c
commit
6c6e98aac4
@ -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: .*
|
||||
|
@ -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:
|
||||
|
@ -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))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user