diff --git a/tests/conftest.py b/tests/conftest.py index 0b82bc7f6..71bc9f388 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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 diff --git a/tests/end2end/conftest.py b/tests/end2end/conftest.py index 5226396a3..136d6eb67 100644 --- a/tests/end2end/conftest.py +++ b/tests/end2end/conftest.py @@ -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]) diff --git a/tests/end2end/fixtures/quteprocess.py b/tests/end2end/fixtures/quteprocess.py index 0c560cf51..7311c7b38 100644 --- a/tests/end2end/fixtures/quteprocess.py +++ b/tests/end2end/fixtures/quteprocess.py @@ -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: diff --git a/tests/end2end/fixtures/test_quteprocess.py b/tests/end2end/fixtures/test_quteprocess.py index 9aab0aa0f..a0dcaf5ce 100644 --- a/tests/end2end/fixtures/test_quteprocess.py +++ b/tests/end2end/fixtures/test_quteprocess.py @@ -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