From daaa5ff5c567d3faa8fba8bbe0079bd186e73853 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Sat, 9 Jul 2016 11:38:32 -0400 Subject: [PATCH 01/12] Don't create real config/data dirs from tests. Running the tests would create ~/.config/qute_test and ~/.local/share/qute_test on the user's machine. The test_standardir module needed a bit more mocking to prevent it from cluttering the user's machine. Two tests that created the data dir were fixed by passing basedir in args, and one test that created the config dir was fixed by patching os.makedirs to a noop. --- tests/unit/utils/test_standarddir.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/unit/utils/test_standarddir.py b/tests/unit/utils/test_standarddir.py index 4c77e1d57..883b9d856 100644 --- a/tests/unit/utils/test_standarddir.py +++ b/tests/unit/utils/test_standarddir.py @@ -195,8 +195,10 @@ class TestArguments: standarddir.init(args) assert standarddir.data() == testcase.expected - def test_confdir_none(self): + def test_confdir_none(self, mocker): """Test --confdir with None given.""" + # patch makedirs to a noop so we don't really create a directory + mocker.patch('qutebrowser.utils.standarddir.os.makedirs') args = types.SimpleNamespace(confdir=None, cachedir=None, datadir=None, basedir=None) standarddir.init(args) @@ -326,12 +328,16 @@ class TestSystemData: assert standarddir.system_data() == "/usr/share/qutebrowser" @pytest.mark.linux - def test_system_datadir_not_exist_linux(self, monkeypatch): + def test_system_datadir_not_exist_linux(self, monkeypatch, tmpdir): """Test that system-wide path isn't used on linux if path not exist.""" + args = types.SimpleNamespace(basedir=str(tmpdir)) + standarddir.init(args) monkeypatch.setattr(os.path, 'exists', lambda path: False) assert standarddir.system_data() == standarddir.data() - def test_system_datadir_unsupportedos(self, monkeypatch): + def test_system_datadir_unsupportedos(self, monkeypatch, tmpdir): """Test that system-wide path is not used on non-Linux OS.""" + args = types.SimpleNamespace(basedir=str(tmpdir)) + standarddir.init(args) monkeypatch.setattr('sys.platform', "potato") assert standarddir.system_data() == standarddir.data() From 1f71520bb2a5bbddb69047a0ca5539cb0bacd0e6 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Sun, 10 Jul 2016 07:44:58 -0400 Subject: [PATCH 02/12] Prevent tests from creating cachedir tag. Running test_standarddir would pollute the user's home with `~/.cache/qute_test`. The `no_cachedir_tag` fixture was supposed to prevent this, but was not working because [usefixtures does not work on fixtures] (https://github.com/pytest-dev/pytest/issues/1014). This fixes the fixture to actually prevent cachedir creation, but applies it to tests individually (or by class) rather than with autouse because the cachedir tests cannot pass if it is working. --- tests/unit/utils/test_standarddir.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/unit/utils/test_standarddir.py b/tests/unit/utils/test_standarddir.py index 883b9d856..bc99e6f7c 100644 --- a/tests/unit/utils/test_standarddir.py +++ b/tests/unit/utils/test_standarddir.py @@ -52,15 +52,15 @@ def no_cachedir_tag(monkeypatch): lambda: None) -@pytest.yield_fixture(autouse=True) -@pytest.mark.usefixtures('no_cachedir_tag') -def reset_standarddir(): +@pytest.yield_fixture +def reset_standarddir(no_cachedir_tag): """Clean up standarddir arguments before and after each test.""" standarddir.init(None) yield standarddir.init(None) +@pytest.mark.usefixtures('reset_standarddir') @pytest.mark.parametrize('data_subdir, config_subdir, expected', [ ('foo', 'foo', 'foo/data'), ('foo', 'bar', 'foo'), @@ -80,6 +80,7 @@ def test_get_fake_windows_equal_dir(data_subdir, config_subdir, expected, assert standarddir.data() == expected +@pytest.mark.usefixtures('reset_standarddir') class TestWritableLocation: """Tests for _writable_location.""" @@ -100,7 +101,7 @@ class TestWritableLocation: assert '\\' in loc -@pytest.mark.usefixtures('no_cachedir_tag') +@pytest.mark.usefixtures('reset_standarddir') class TestStandardDir: """Tests for standarddir.""" @@ -159,7 +160,7 @@ class TestStandardDir: DirArgTest = collections.namedtuple('DirArgTest', 'arg, expected') -@pytest.mark.usefixtures('no_cachedir_tag') +@pytest.mark.usefixtures('reset_standarddir') class TestArguments: """Tests with confdir/cachedir/datadir arguments.""" @@ -274,6 +275,7 @@ class TestInitCacheDirTag: assert not tmpdir.listdir() +@pytest.mark.usefixtures('reset_standarddir') class TestCreatingDir: """Make sure inexistent directories are created properly.""" @@ -317,6 +319,7 @@ class TestCreatingDir: func() +@pytest.mark.usefixtures('reset_standarddir') class TestSystemData: """Test system data path.""" From 34583d15658da161471087ec765d773e29c16400 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Mon, 11 Jul 2016 07:10:53 -0400 Subject: [PATCH 03/12] Fix standarddir test on Windows. Was broken by 48a2cad while trying to prevent creation of qute_test in non-temp locations. --- tests/unit/utils/test_standarddir.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/unit/utils/test_standarddir.py b/tests/unit/utils/test_standarddir.py index bc99e6f7c..97dde62d9 100644 --- a/tests/unit/utils/test_standarddir.py +++ b/tests/unit/utils/test_standarddir.py @@ -275,7 +275,6 @@ class TestInitCacheDirTag: assert not tmpdir.listdir() -@pytest.mark.usefixtures('reset_standarddir') class TestCreatingDir: """Make sure inexistent directories are created properly.""" @@ -288,6 +287,7 @@ class TestCreatingDir: basedir = tmpdir / 'basedir' assert not basedir.exists() args = types.SimpleNamespace(basedir=str(basedir)) + standarddir.init(None) standarddir.init(args) func = getattr(standarddir, typ) @@ -298,6 +298,7 @@ class TestCreatingDir: if os.name == 'posix': assert basedir.stat().mode & 0o777 == 0o700 + @pytest.mark.usefixtures('reset_standarddir') @pytest.mark.parametrize('typ', DIR_TYPES) def test_exists_race_condition(self, mocker, tmpdir, typ): """Make sure there can't be a TOCTOU issue when creating the file. From cee5d6b97ff6dd054852030d894dfad37d6c2f12 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Mon, 11 Jul 2016 21:14:33 -0400 Subject: [PATCH 04/12] Use fake_args in test_standarddir. --- tests/unit/utils/test_standarddir.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/unit/utils/test_standarddir.py b/tests/unit/utils/test_standarddir.py index 97dde62d9..5aba28c03 100644 --- a/tests/unit/utils/test_standarddir.py +++ b/tests/unit/utils/test_standarddir.py @@ -332,16 +332,18 @@ class TestSystemData: assert standarddir.system_data() == "/usr/share/qutebrowser" @pytest.mark.linux - def test_system_datadir_not_exist_linux(self, monkeypatch, tmpdir): + def test_system_datadir_not_exist_linux(self, monkeypatch, tmpdir, + fake_args): """Test that system-wide path isn't used on linux if path not exist.""" - args = types.SimpleNamespace(basedir=str(tmpdir)) - standarddir.init(args) + fake_args.basedir = str(tmpdir) + standarddir.init(fake_args) monkeypatch.setattr(os.path, 'exists', lambda path: False) assert standarddir.system_data() == standarddir.data() - def test_system_datadir_unsupportedos(self, monkeypatch, tmpdir): + def test_system_datadir_unsupportedos(self, monkeypatch, tmpdir, + fake_args): """Test that system-wide path is not used on non-Linux OS.""" - args = types.SimpleNamespace(basedir=str(tmpdir)) - standarddir.init(args) + fake_args.basedir = str(tmpdir) + standarddir.init(fake_args) monkeypatch.setattr('sys.platform', "potato") assert standarddir.system_data() == standarddir.data() From 9c9b367887ceaca5dae044f20b836b28cb09ff42 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Tue, 12 Jul 2016 07:05:30 -0400 Subject: [PATCH 05/12] Completely prevent tests from creating cachedir. Attempting to fix the test on windows caused it to create the cachedir again. The call to init(None) was unnecessary. --- tests/unit/utils/test_standarddir.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unit/utils/test_standarddir.py b/tests/unit/utils/test_standarddir.py index 5aba28c03..a04797258 100644 --- a/tests/unit/utils/test_standarddir.py +++ b/tests/unit/utils/test_standarddir.py @@ -287,7 +287,6 @@ class TestCreatingDir: basedir = tmpdir / 'basedir' assert not basedir.exists() args = types.SimpleNamespace(basedir=str(basedir)) - standarddir.init(None) standarddir.init(args) func = getattr(standarddir, typ) From a6695ea1bee1d2815a41baa8733273216568ed00 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Thu, 14 Jul 2016 12:24:44 -0400 Subject: [PATCH 06/12] Prevent test_adblock from creating real config dir. Don't create ~/.config/qute_test by mocking out standdarddir.config for all tests in this module. This adds config_tmpdir to fixtures.py and moves temp_datadir from test_adblock to fixtures.py as it will be needed more broadly. --- tests/helpers/fixtures.py | 27 +++++++++++++++++++++++++++ tests/unit/browser/test_adblock.py | 11 ++--------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/tests/helpers/fixtures.py b/tests/helpers/fixtures.py index 464d0c520..eea527779 100644 --- a/tests/helpers/fixtures.py +++ b/tests/helpers/fixtures.py @@ -30,6 +30,7 @@ import itertools import textwrap import unittest.mock import types +import os import pytest @@ -405,3 +406,29 @@ def mode_manager(win_registry, config_stub, qapp): objreg.register('mode-manager', mm, scope='window', window=0) yield mm objreg.delete('mode-manager', scope='window', window=0) + + +@pytest.fixture +def config_tmpdir(monkeypatch, tmpdir): + """Set tmpdir/config as the configdir. + + Use this to avoid creating a 'real' config dir (~/.config/qute_test). + """ + tmpdir = tmpdir / 'config' + path = str(tmpdir) + os.mkdir(path) + monkeypatch.setattr('qutebrowser.utils.standarddir.config', lambda: path) + return tmpdir + + +@pytest.fixture +def data_tmpdir(monkeypatch, tmpdir): + """Set tmpdir/data as the datadir. + + Use this to avoid creating a 'real' data dir (~/.local/share/qute_test). + """ + tmpdir = tmpdir / 'data' + path = str(tmpdir) + os.mkdir(path) + monkeypatch.setattr('qutebrowser.utils.standarddir.data', lambda: path) + return tmpdir diff --git a/tests/unit/browser/test_adblock.py b/tests/unit/browser/test_adblock.py index be801de73..b300c8a26 100644 --- a/tests/unit/browser/test_adblock.py +++ b/tests/unit/browser/test_adblock.py @@ -30,7 +30,7 @@ from qutebrowser.browser import adblock from qutebrowser.utils import objreg from qutebrowser.commands import cmdexc -pytestmark = pytest.mark.usefixtures('qapp') +pytestmark = pytest.mark.usefixtures('qapp', 'config_tmpdir') # TODO See ../utils/test_standarddirutils for OSError and caplog assertion @@ -54,13 +54,6 @@ URLS_TO_CHECK = ('http://localhost', 'http://qutebrowser.org') -@pytest.fixture -def data_tmpdir(monkeypatch, tmpdir): - """Set tmpdir as datadir.""" - tmpdir = str(tmpdir) - monkeypatch.setattr('qutebrowser.utils.standarddir.data', lambda: tmpdir) - - class BaseDirStub: """Mock for objreg.get('args') called in adblock.HostBlocker.read_hosts.""" @@ -348,7 +341,7 @@ def test_blocking_with_whitelist(config_stub, basedir, download_stub, # by creating a file named blocked-hosts, # Exclude localhost from it, since localhost is in HostBlocker.WHITELISTED filtered_blocked_hosts = BLOCKLIST_HOSTS[1:] - blocklist = create_blocklist(tmpdir, + blocklist = create_blocklist(data_tmpdir, blocked_hosts=filtered_blocked_hosts, name='blocked-hosts', line_format='one_per_line') From d9b546701ecb962e5edd4fdb4ca2f28f80be549b Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Thu, 14 Jul 2016 20:07:11 -0400 Subject: [PATCH 07/12] Prevent creation of user dirs on several tests. Use the config_tempdir and data_tempdir fixtures for several tests that were creation ~/.config/qute_test or ~/.local/share/qute_test. --- tests/unit/browser/webkit/test_cookies.py | 2 ++ tests/unit/config/test_config.py | 2 ++ tests/unit/config/test_configtypes.py | 2 ++ tests/unit/config/test_configtypes_hypothesis.py | 2 +- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/unit/browser/webkit/test_cookies.py b/tests/unit/browser/webkit/test_cookies.py index 2d764af42..bcee01e60 100644 --- a/tests/unit/browser/webkit/test_cookies.py +++ b/tests/unit/browser/webkit/test_cookies.py @@ -24,6 +24,8 @@ import pytest from qutebrowser.browser.webkit import cookies from qutebrowser.misc import lineparser +pytestmark = pytest.mark.usefixtures('data_tmpdir') + CONFIG_ALL_COOKIES = {'content': {'cookies-accept': 'all'}} CONFIG_NEVER_COOKIES = {'content': {'cookies-accept': 'never'}} CONFIG_COOKIES_ENABLED = {'content': {'cookies-store': True}} diff --git a/tests/unit/config/test_config.py b/tests/unit/config/test_config.py index 256aac03f..abb1d542b 100644 --- a/tests/unit/config/test_config.py +++ b/tests/unit/config/test_config.py @@ -35,6 +35,8 @@ from qutebrowser.config.parsers import keyconf from qutebrowser.commands import runners from qutebrowser.utils import objreg, standarddir +pytestmark = pytest.mark.usefixtures('config_tmpdir') + class TestConfigParser: diff --git a/tests/unit/config/test_configtypes.py b/tests/unit/config/test_configtypes.py index 6998d86cd..648bb393f 100644 --- a/tests/unit/config/test_configtypes.py +++ b/tests/unit/config/test_configtypes.py @@ -33,6 +33,8 @@ from PyQt5.QtNetwork import QNetworkProxy from qutebrowser.config import configtypes, configexc from qutebrowser.utils import debug, utils +pytestmark = pytest.mark.usefixtures('config_tmpdir') + class Font(QFont): diff --git a/tests/unit/config/test_configtypes_hypothesis.py b/tests/unit/config/test_configtypes_hypothesis.py index fe7807c4a..c5a5b9ac0 100644 --- a/tests/unit/config/test_configtypes_hypothesis.py +++ b/tests/unit/config/test_configtypes_hypothesis.py @@ -42,7 +42,7 @@ def gen_classes(): yield member -@pytest.mark.usefixtures('qapp') +@pytest.mark.usefixtures('qapp', 'config_tmpdir') @pytest.mark.parametrize('klass', gen_classes()) @hypothesis.given(strategies.text()) @hypothesis.example('\x00') From f589e4470066b3b3b40e5a6d3b268cc27414f358 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Thu, 14 Jul 2016 20:25:42 -0400 Subject: [PATCH 08/12] Don't write to user datadir in test_qt_javascript. This was more complicated than the other data/config/cachedir test fixes, as QtWebEngine was accessing the datadir directly (and bypassing standdarddir.data). This means the tmpdir_data stub is not enough, we need to set XDG_DATA_HOME to redirect access. --- tests/unit/browser/webkit/test_qt_javascript.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/unit/browser/webkit/test_qt_javascript.py b/tests/unit/browser/webkit/test_qt_javascript.py index 235296ca4..37ff5d0da 100644 --- a/tests/unit/browser/webkit/test_qt_javascript.py +++ b/tests/unit/browser/webkit/test_qt_javascript.py @@ -21,6 +21,7 @@ import pytest +import os from PyQt5.QtCore import QObject, pyqtSignal from PyQt5.QtWebKit import QWebSettings @@ -65,12 +66,17 @@ def test_element_js_webkit(webview, js_enabled, expected): @pytest.mark.parametrize('js_enabled, expected', [(True, 2.0), (False, 2.0)]) -def test_simple_js_webengine(qtbot, webengineview, js_enabled, expected): +def test_simple_js_webengine(qtbot, webengineview, js_enabled, expected, + data_tmpdir): """With QtWebEngine, runJavaScript works even when JS is off.""" # pylint: disable=no-name-in-module,useless-suppression # If we get there (because of the webengineview fixture) we can be certain # QtWebEngine is available from PyQt5.QtWebEngineWidgets import QWebEngineSettings + # runJavaScript will write to the data directory. As the path is determined + # by Qt and bypasses standarddir.data(), the data_tmpdir fixture is not + # enough -- we need to set XDG_DATA_HOME as well + os.putenv('XDG_DATA_HOME', str(data_tmpdir)) webengineview.settings().setAttribute(QWebEngineSettings.JavascriptEnabled, js_enabled) From 5ae9d985b1feb0b4172826edf709aab68a16e4f3 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Sat, 16 Jul 2016 06:47:12 -0400 Subject: [PATCH 09/12] Prevent lingering object from test_config. Using the config_tmdpir fixture across all tests in this module caused a lingering LineParser to make test_debug fail. I still don't know why, but scoping the config_tmpdir fixture to only the test class that was creating ~/.config/qute_test fixes the issue, and still prevents creation of a user tempdir. --- tests/unit/config/test_config.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/unit/config/test_config.py b/tests/unit/config/test_config.py index abb1d542b..bd8e92910 100644 --- a/tests/unit/config/test_config.py +++ b/tests/unit/config/test_config.py @@ -35,8 +35,6 @@ from qutebrowser.config.parsers import keyconf from qutebrowser.commands import runners from qutebrowser.utils import objreg, standarddir -pytestmark = pytest.mark.usefixtures('config_tmpdir') - class TestConfigParser: @@ -297,6 +295,7 @@ class TestKeyConfigParser: assert new == new_expected +@pytest.mark.usefixtures('config_tmpdir') @pytest.mark.integration class TestDefaultConfig: From 7d36847f77f047b19ca2d1d251e8300edb70d8d0 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Sat, 16 Jul 2016 08:17:07 -0400 Subject: [PATCH 10/12] Prevent test_tab from creating user data dir. This is another case (like test_qt_javascript) that needs redirection of XDG_DATA_HOME to prevent Qt from creating ~/.share/local/qute_test. --- tests/helpers/fixtures.py | 11 +++++++++++ tests/unit/browser/test_tab.py | 2 ++ tests/unit/browser/webkit/test_qt_javascript.py | 9 ++------- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/helpers/fixtures.py b/tests/helpers/fixtures.py index eea527779..1f17d9836 100644 --- a/tests/helpers/fixtures.py +++ b/tests/helpers/fixtures.py @@ -432,3 +432,14 @@ def data_tmpdir(monkeypatch, tmpdir): os.mkdir(path) monkeypatch.setattr('qutebrowser.utils.standarddir.data', lambda: path) return tmpdir + + +@pytest.fixture +def redirect_xdg_data(data_tmpdir): + """Set XDG_DATA_HOME to a temp location. + + While data_tmpdir covers most cases by redirecting standarddir.data(), this + is not enough for places Qt references the data dir internally. For these, + we need to set the environment variable to redirect data access. + """ + os.putenv('XDG_DATA_HOME', str(data_tmpdir)) diff --git a/tests/unit/browser/test_tab.py b/tests/unit/browser/test_tab.py index 2d7ac8d4c..667277d9c 100644 --- a/tests/unit/browser/test_tab.py +++ b/tests/unit/browser/test_tab.py @@ -25,6 +25,8 @@ from qutebrowser.browser import browsertab from qutebrowser.keyinput import modeman from qutebrowser.utils import objreg +pytestmark = pytest.mark.usefixtures('redirect_xdg_data') + try: from PyQt5.QtWebKitWidgets import QWebView diff --git a/tests/unit/browser/webkit/test_qt_javascript.py b/tests/unit/browser/webkit/test_qt_javascript.py index 37ff5d0da..5dc70bf0d 100644 --- a/tests/unit/browser/webkit/test_qt_javascript.py +++ b/tests/unit/browser/webkit/test_qt_javascript.py @@ -21,7 +21,6 @@ import pytest -import os from PyQt5.QtCore import QObject, pyqtSignal from PyQt5.QtWebKit import QWebSettings @@ -65,18 +64,14 @@ def test_element_js_webkit(webview, js_enabled, expected): assert result == expected +@pytest.mark.usefixtures('redirect_xdg_data') @pytest.mark.parametrize('js_enabled, expected', [(True, 2.0), (False, 2.0)]) -def test_simple_js_webengine(qtbot, webengineview, js_enabled, expected, - data_tmpdir): +def test_simple_js_webengine(qtbot, webengineview, js_enabled, expected): """With QtWebEngine, runJavaScript works even when JS is off.""" # pylint: disable=no-name-in-module,useless-suppression # If we get there (because of the webengineview fixture) we can be certain # QtWebEngine is available from PyQt5.QtWebEngineWidgets import QWebEngineSettings - # runJavaScript will write to the data directory. As the path is determined - # by Qt and bypasses standarddir.data(), the data_tmpdir fixture is not - # enough -- we need to set XDG_DATA_HOME as well - os.putenv('XDG_DATA_HOME', str(data_tmpdir)) webengineview.settings().setAttribute(QWebEngineSettings.JavascriptEnabled, js_enabled) From 7b3406a3e4661562de7d37aae41a0ff56dcecf57 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Mon, 18 Jul 2016 21:39:35 -0400 Subject: [PATCH 11/12] Use monkeypatch.setenv instead of os.putenv. This ensures the environment is modified only for the test using the fixture rather than for the whole test run. --- tests/helpers/fixtures.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/helpers/fixtures.py b/tests/helpers/fixtures.py index 1f17d9836..016767214 100644 --- a/tests/helpers/fixtures.py +++ b/tests/helpers/fixtures.py @@ -435,11 +435,11 @@ def data_tmpdir(monkeypatch, tmpdir): @pytest.fixture -def redirect_xdg_data(data_tmpdir): +def redirect_xdg_data(data_tmpdir, monkeypatch): """Set XDG_DATA_HOME to a temp location. While data_tmpdir covers most cases by redirecting standarddir.data(), this is not enough for places Qt references the data dir internally. For these, we need to set the environment variable to redirect data access. """ - os.putenv('XDG_DATA_HOME', str(data_tmpdir)) + monkeypatch.setenv('XDG_DATA_HOME', str(data_tmpdir)) From 48dbf505ce9d284df7f2a2e9654c241e9bf083df Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Mon, 18 Jul 2016 21:49:37 -0400 Subject: [PATCH 12/12] Limit config_tmpdir use in test_configtypes. Only use the fixture in the test class that tries to access the config dir (TestFileAndUserStyleSheet) rather than the whole test. --- tests/unit/config/test_configtypes.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/unit/config/test_configtypes.py b/tests/unit/config/test_configtypes.py index 648bb393f..38958be5d 100644 --- a/tests/unit/config/test_configtypes.py +++ b/tests/unit/config/test_configtypes.py @@ -33,8 +33,6 @@ from PyQt5.QtNetwork import QNetworkProxy from qutebrowser.config import configtypes, configexc from qutebrowser.utils import debug, utils -pytestmark = pytest.mark.usefixtures('config_tmpdir') - class Font(QFont): @@ -1284,6 +1282,7 @@ def unrequired_class(**kwargs): @pytest.mark.usefixtures('qapp') +@pytest.mark.usefixtures('config_tmpdir') class TestFileAndUserStyleSheet: """Test File/UserStyleSheet."""