summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2022-11-29 08:56:53 +0100
committerFlorian Bruhin <me@the-compiler.org>2022-11-29 08:56:53 +0100
commit100e654fd754f4dfd1fbebdc2c09ab3923b34891 (patch)
tree7929999b81a2bc4b8c6e73389de2ea31a842513f
parentc1dcb1164f963f82d3bc093c2fd1941914021a21 (diff)
downloadqutebrowser-100e654fd754f4dfd1fbebdc2c09ab3923b34891.tar.gz
qutebrowser-100e654fd754f4dfd1fbebdc2c09ab3923b34891.zip
tests: Replace class-level pytestmark by decorators
-rw-r--r--tests/unit/browser/test_navigate.py3
-rw-r--r--tests/unit/browser/webkit/test_webkitelem.py3
-rw-r--r--tests/unit/config/test_configcommands.py12
-rw-r--r--tests/unit/config/test_configfiles.py6
4 files changed, 9 insertions, 15 deletions
diff --git a/tests/unit/browser/test_navigate.py b/tests/unit/browser/test_navigate.py
index 9813705ca..7c3173602 100644
--- a/tests/unit/browser/test_navigate.py
+++ b/tests/unit/browser/test_navigate.py
@@ -26,10 +26,9 @@ from qutebrowser.browser import navigate
from qutebrowser.utils import urlutils
+@pytest.mark.usefixtures('config_stub')
class TestIncDec:
- pytestmark = pytest.mark.usefixtures('config_stub')
-
@pytest.mark.parametrize('incdec', ['increment', 'decrement'])
@pytest.mark.parametrize('value', [
'{}foo', 'foo{}', 'foo{}bar', '42foo{}'
diff --git a/tests/unit/browser/webkit/test_webkitelem.py b/tests/unit/browser/webkit/test_webkitelem.py
index 7df91922d..d580fec99 100644
--- a/tests/unit/browser/webkit/test_webkitelem.py
+++ b/tests/unit/browser/webkit/test_webkitelem.py
@@ -678,10 +678,9 @@ class TestIsVisibleIframe:
assert not invalid_objects.elems[1]._is_visible(invalid_objects.frame)
+@pytest.mark.usefixtures('config_stub')
class TestRectOnView:
- pytestmark = pytest.mark.usefixtures('config_stub')
-
@pytest.mark.parametrize('js_rect', [
None, # real geometry via getElementRects
{}, # no geometry at all via getElementRects
diff --git a/tests/unit/config/test_configcommands.py b/tests/unit/config/test_configcommands.py
index 22de04070..e641efb00 100644
--- a/tests/unit/config/test_configcommands.py
+++ b/tests/unit/config/test_configcommands.py
@@ -517,13 +517,12 @@ class TestUnsetAndClear:
assert yaml_value(name) == (usertypes.UNSET if save else 'never')
+@pytest.mark.usefixtures('config_tmpdir', 'data_tmpdir',
+ 'config_stub', 'key_config_stub')
class TestSource:
"""Test :config-source."""
- pytestmark = pytest.mark.usefixtures('config_tmpdir', 'data_tmpdir',
- 'config_stub', 'key_config_stub')
-
@pytest.mark.parametrize('location', ['default', 'absolute', 'relative'])
@pytest.mark.parametrize('clear', [True, False])
def test_config_source(self, tmp_path, commands, config_stub, config_tmpdir,
@@ -601,14 +600,13 @@ class TestSource:
assert str(excinfo.value) == expected
+@pytest.mark.usefixtures('config_tmpdir', 'data_tmpdir',
+ 'config_stub', 'key_config_stub',
+ 'qapp')
class TestEdit:
"""Tests for :config-edit."""
- pytestmark = pytest.mark.usefixtures('config_tmpdir', 'data_tmpdir',
- 'config_stub', 'key_config_stub',
- 'qapp')
-
def test_no_source(self, commands, mocker):
mock = mocker.patch('qutebrowser.config.configcommands.editor.'
'ExternalEditor._start_editor', autospec=True)
diff --git a/tests/unit/config/test_configfiles.py b/tests/unit/config/test_configfiles.py
index f93986306..e0ebbabdf 100644
--- a/tests/unit/config/test_configfiles.py
+++ b/tests/unit/config/test_configfiles.py
@@ -851,10 +851,9 @@ def confpy(tmp_path, config_tmpdir, data_tmpdir, config_stub, key_config_stub):
return ConfPy(tmp_path)
+@pytest.mark.usefixtures('config_stub', 'key_config_stub')
class TestConfigPyModules:
- pytestmark = pytest.mark.usefixtures('config_stub', 'key_config_stub')
-
@pytest.fixture
def qbmodulepy(self, tmp_path):
return ConfPy(tmp_path, filename="qbmodule.py")
@@ -911,12 +910,11 @@ class TestConfigPyModules:
assert sys.path.count(tmp_path) == 1
+@pytest.mark.usefixtures('config_stub', 'key_config_stub')
class TestConfigPy:
"""Tests for ConfigAPI and read_config_py()."""
- pytestmark = pytest.mark.usefixtures('config_stub', 'key_config_stub')
-
def test_assertions(self, confpy):
"""Make sure assertions in config.py work for these tests."""
confpy.write('assert False')