tests: Adjust getting markers for pytest 3.6

This commit is contained in:
Florian Bruhin 2018-06-07 19:29:01 +02:00
parent dc203d46de
commit 11b957f24b
4 changed files with 8 additions and 8 deletions

View File

@ -80,7 +80,7 @@ def _apply_platform_markers(config, item):
]
for searched_marker, condition, default_reason in markers:
marker = item.get_marker(searched_marker)
marker = item.get_closest_marker(searched_marker)
if not marker or not condition:
continue
@ -138,9 +138,9 @@ def pytest_collection_modifyitems(config, items):
item.add_marker(pytest.mark.end2end)
_apply_platform_markers(config, item)
if item.get_marker('xfail_norun'):
if list(item.iter_markers('xfail_norun')):
item.add_marker(pytest.mark.xfail(run=False))
if item.get_marker('js_prompt'):
if list(item.iter_markers('js_prompt')):
if config.webengine:
item.add_marker(pytest.mark.skipif(
PYQT_VERSION <= 0x050700,
@ -226,7 +226,7 @@ def set_backend(monkeypatch, request):
@pytest.fixture(autouse=True)
def apply_fake_os(monkeypatch, request):
fake_os = request.node.get_marker('fake_os')
fake_os = request.node.get_closest_marker('fake_os')
if not fake_os:
return

View File

@ -151,7 +151,7 @@ def pytest_collection_modifyitems(config, items):
for item in items:
for name, prefix, pytest_mark, condition in markers:
marker = item.get_marker(name)
marker = item.get_closest_marker(name)
if marker and condition:
if marker.args:
text = '{}: {}'.format(prefix, marker.args[0])

View File

@ -394,7 +394,7 @@ class QuteProc(testprocess.Process):
elif (is_ignored_qt_message(self.request.config, line) or
is_ignored_lowlevel_message(line) or
is_ignored_chromium_message(line) or
self.request.node.get_marker('no_invalid_lines')):
list(self.request.node.iter_markers('no_invalid_lines'))):
self._log("IGNORED: {}".format(line))
return None
else:
@ -501,7 +501,7 @@ class QuteProc(testprocess.Process):
"""Extend wait_for to add divisor if a test is xfailing."""
__tracebackhide__ = (lambda e:
e.errisinstance(testprocess.WaitForTimeout))
xfail = self.request.node.get_marker('xfail')
xfail = self.request.node.get_closest_marker('xfail')
if xfail and (not xfail.args or xfail.args[0]):
kwargs['divisor'] = 10
else:

View File

@ -68,7 +68,7 @@ class FakeNode:
def __init__(self, call):
self.rep_call = call
def get_marker(self, _name):
def get_closest_marker(self, _name):
return None