tests: Improve @qtwebengine_* markers

This uses xfail for @qtwebengine_todo and adds a new @qtwebengine_skip
marker.
This commit is contained in:
Florian Bruhin 2016-08-18 18:16:33 +02:00
parent dfed2f9c9c
commit 8d381aaa01
2 changed files with 14 additions and 4 deletions

View File

@ -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: .*

View File

@ -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)