Fix tests without DISPLAY.
This commit is contained in:
parent
1861b0a5e4
commit
4854ca42fd
@ -128,7 +128,7 @@ def test_purge_old_cookies(config_stub, fake_save_manager):
|
||||
assert raw_cookies == [COOKIE1, COOKIE2, SESSION_COOKIE]
|
||||
|
||||
|
||||
def test_save(config_stub, fake_save_manager, monkeypatch):
|
||||
def test_save(config_stub, fake_save_manager, monkeypatch, qapp):
|
||||
"""Test that expired and session cookies are not saved."""
|
||||
monkeypatch.setattr(lineparser,
|
||||
'LineParser', LineparserSaveStub)
|
||||
@ -156,7 +156,7 @@ def test_cookies_changed_emit(config_stub, fake_save_manager,
|
||||
|
||||
|
||||
def test_cookies_changed_not_emitted(config_stub, fake_save_manager,
|
||||
monkeypatch):
|
||||
monkeypatch, qapp):
|
||||
"""Test that changed is not emitted when nothing changes."""
|
||||
config_stub.data = CONFIG_COOKIES_ENABLED
|
||||
monkeypatch.setattr(lineparser,
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
"""Hypothesis tests for qutebrowser.config.configtypes."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import inspect
|
||||
import functools
|
||||
|
||||
@ -44,6 +46,11 @@ def gen_classes():
|
||||
@hypothesis.given(strategies.text())
|
||||
@hypothesis.example('\x00')
|
||||
def test_configtypes_hypothesis(klass, s):
|
||||
if (klass in [configtypes.File, configtypes.UserStyleSheet] and
|
||||
sys.platform == 'linux' and
|
||||
not os.environ.get('DISPLAY', '')):
|
||||
pytest.skip("No DISPLAY available")
|
||||
|
||||
try:
|
||||
klass().validate(s)
|
||||
except configexc.ValidationError:
|
||||
|
@ -45,6 +45,9 @@ from helpers import stubs # pylint: disable=import-error
|
||||
Args = collections.namedtuple('Args', 'basedir')
|
||||
|
||||
|
||||
pytestmark = pytest.mark.usefixtures('qapp')
|
||||
|
||||
|
||||
@pytest.yield_fixture()
|
||||
def short_tmpdir():
|
||||
with tempfile.TemporaryDirectory() as tdir:
|
||||
|
Loading…
Reference in New Issue
Block a user