parent
fbf53168c2
commit
2fe1bcfc2b
@ -238,6 +238,7 @@ class TestDefaultConfig:
|
||||
|
||||
"""Test validating of the default config."""
|
||||
|
||||
@pytest.mark.usefixtures('qapp')
|
||||
def test_default_config(self):
|
||||
"""Test validating of the default config."""
|
||||
conf = config.ConfigManager(None, None)
|
||||
|
@ -120,8 +120,14 @@ def pytest_collection_modifyitems(items):
|
||||
http://pytest.org/latest/plugins.html
|
||||
"""
|
||||
for item in items:
|
||||
if 'qtbot' in getattr(item, 'fixturenames', ()):
|
||||
if 'qapp' in getattr(item, 'fixturenames', ()):
|
||||
item.add_marker('gui')
|
||||
if sys.platform == 'linux' and not os.environ.get('DISPLAY', ''):
|
||||
if 'CI' in os.environ:
|
||||
raise Exception("No display available on CI!")
|
||||
skip_marker = pytest.mark.skipif(
|
||||
True, reason="No DISPLAY available")
|
||||
item.add_marker(skip_marker)
|
||||
|
||||
|
||||
def _generate_cmdline_tests():
|
||||
|
@ -185,7 +185,7 @@ class TestKeyChain:
|
||||
self.kp.execute.assert_called_once_with('0', self.kp.Type.chain, None)
|
||||
assert self.kp._keystring == ''
|
||||
|
||||
def test_ambiguous_keychain(self, fake_keyevent_factory, config_stub,
|
||||
def test_ambiguous_keychain(self, qapp, fake_keyevent_factory, config_stub,
|
||||
monkeypatch):
|
||||
"""Test ambiguous keychain."""
|
||||
config_stub.data = CONFIG
|
||||
|
@ -505,19 +505,18 @@ class TestSavefileOpen:
|
||||
|
||||
|
||||
@pytest.mark.parametrize('orgname, expected', [(None, ''), ('test', 'test')])
|
||||
def test_unset_organization(orgname, expected):
|
||||
def test_unset_organization(qapp, orgname, expected):
|
||||
"""Test unset_organization.
|
||||
|
||||
Args:
|
||||
orgname: The organizationName to set initially.
|
||||
expected: The organizationName which is expected when reading back.
|
||||
"""
|
||||
app = QApplication.instance()
|
||||
app.setOrganizationName(orgname)
|
||||
assert app.organizationName() == expected # sanity check
|
||||
qapp.setOrganizationName(orgname)
|
||||
assert qapp.organizationName() == expected # sanity check
|
||||
with qtutils.unset_organization():
|
||||
assert app.organizationName() == ''
|
||||
assert app.organizationName() == expected
|
||||
assert qapp.organizationName() == ''
|
||||
assert qapp.organizationName() == expected
|
||||
|
||||
|
||||
if test_file is not None:
|
||||
@ -921,6 +920,7 @@ class TestPyQIODevice:
|
||||
assert str(excinfo.value) == 'Reading failed'
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('qapp')
|
||||
class TestEventLoop:
|
||||
|
||||
"""Tests for EventLoop.
|
||||
|
@ -36,16 +36,16 @@ from qutebrowser.utils import standarddir
|
||||
|
||||
|
||||
@pytest.yield_fixture(autouse=True)
|
||||
def change_qapp_name():
|
||||
def change_qapp_name(qapp):
|
||||
"""Change the name of the QApplication instance.
|
||||
|
||||
This changes the applicationName for all tests in this module to
|
||||
"qutebrowser_test".
|
||||
"""
|
||||
old_name = QApplication.instance().applicationName()
|
||||
QApplication.instance().setApplicationName('qutebrowser_test')
|
||||
old_name = qapp.applicationName()
|
||||
qapp.setApplicationName('qutebrowser_test')
|
||||
yield
|
||||
QApplication.instance().setApplicationName(old_name)
|
||||
qapp.setApplicationName(old_name)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
2
tox.ini
2
tox.ini
@ -11,7 +11,7 @@ envlist = py34,misc,pep257,pyflakes,pep8,mccabe,pylint,pyroma,check-manifest
|
||||
setenv =
|
||||
QT_QPA_PLATFORM_PLUGIN_PATH={envdir}/Lib/site-packages/PyQt5/plugins/platforms
|
||||
PYTEST_QT_API=pyqt5
|
||||
passenv = PYTHON DISPLAY XAUTHORITY HOME USERNAME USER
|
||||
passenv = PYTHON DISPLAY XAUTHORITY HOME USERNAME USER CI
|
||||
deps =
|
||||
-r{toxinidir}/requirements.txt
|
||||
py==1.4.30
|
||||
|
Loading…
Reference in New Issue
Block a user