Stop supporting running tests without Xvfb/DISPLAY

This always caused problems and unneeded complexity in the past, and it
also increases Travis CI runtime.

We now require either a DISPLAY during tests or Xvfb being installed.
This commit is contained in:
Florian Bruhin 2016-04-06 08:27:43 +02:00
parent 2aef8913ec
commit 9ea7716b06
3 changed files with 4 additions and 21 deletions

View File

@ -7,8 +7,6 @@ matrix:
include:
- os: linux
env: TESTENV=py34-cov
- os: linux
env: TESTENV=unittests-nodisp
- os: linux
env: DOCKER=debian-jessie
services: docker

View File

@ -100,13 +100,6 @@ def pytest_collection_modifyitems(items):
for item in items:
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 and
not os.environ.get('QUTE_NO_DISPLAY', '')):
raise Exception("No display available on CI!")
skip_marker = pytest.mark.skipif(
True, reason="No DISPLAY available")
item.add_marker(skip_marker)
if hasattr(item, 'module'):
module_path = os.path.relpath(
@ -151,12 +144,15 @@ def pytest_addoption(parser):
@pytest.fixture(scope='session', autouse=True)
def prevent_xvfb_on_buildbot(request):
def check_display(request):
if (not request.config.getoption('--no-xvfb') and
'QUTE_BUILDBOT' in os.environ and
request.config.xvfb is not None):
raise Exception("Xvfb is running on buildbot!")
if sys.platform == 'linux' and not os.environ.get('DISPLAY', ''):
raise Exception("No display and no Xvfb available!")
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item, call):

11
tox.ini
View File

@ -90,17 +90,6 @@ commands =
{envpython} scripts/dev/freeze_tests.py build_exe -b {envdir}/build
{envdir}/build/run-frozen-tests {posargs}
[testenv:unittests-nodisp]
basepython = python3
passenv = {[testenv]passenv}
deps = {[testenv]deps}
setenv =
DISPLAY=
QUTE_NO_DISPLAY=1
commands =
{envpython} scripts/link_pyqt.py --tox {envdir}
{envpython} -m pytest {posargs:tests}
[testenv:misc]
ignore_errors = true
basepython = python3