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:
parent
2aef8913ec
commit
9ea7716b06
@ -7,8 +7,6 @@ matrix:
|
|||||||
include:
|
include:
|
||||||
- os: linux
|
- os: linux
|
||||||
env: TESTENV=py34-cov
|
env: TESTENV=py34-cov
|
||||||
- os: linux
|
|
||||||
env: TESTENV=unittests-nodisp
|
|
||||||
- os: linux
|
- os: linux
|
||||||
env: DOCKER=debian-jessie
|
env: DOCKER=debian-jessie
|
||||||
services: docker
|
services: docker
|
||||||
|
@ -100,13 +100,6 @@ def pytest_collection_modifyitems(items):
|
|||||||
for item in items:
|
for item in items:
|
||||||
if 'qapp' in getattr(item, 'fixturenames', ()):
|
if 'qapp' in getattr(item, 'fixturenames', ()):
|
||||||
item.add_marker('gui')
|
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'):
|
if hasattr(item, 'module'):
|
||||||
module_path = os.path.relpath(
|
module_path = os.path.relpath(
|
||||||
@ -151,12 +144,15 @@ def pytest_addoption(parser):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='session', autouse=True)
|
@pytest.fixture(scope='session', autouse=True)
|
||||||
def prevent_xvfb_on_buildbot(request):
|
def check_display(request):
|
||||||
if (not request.config.getoption('--no-xvfb') and
|
if (not request.config.getoption('--no-xvfb') and
|
||||||
'QUTE_BUILDBOT' in os.environ and
|
'QUTE_BUILDBOT' in os.environ and
|
||||||
request.config.xvfb is not None):
|
request.config.xvfb is not None):
|
||||||
raise Exception("Xvfb is running on buildbot!")
|
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)
|
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
|
||||||
def pytest_runtest_makereport(item, call):
|
def pytest_runtest_makereport(item, call):
|
||||||
|
11
tox.ini
11
tox.ini
@ -90,17 +90,6 @@ commands =
|
|||||||
{envpython} scripts/dev/freeze_tests.py build_exe -b {envdir}/build
|
{envpython} scripts/dev/freeze_tests.py build_exe -b {envdir}/build
|
||||||
{envdir}/build/run-frozen-tests {posargs}
|
{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]
|
[testenv:misc]
|
||||||
ignore_errors = true
|
ignore_errors = true
|
||||||
basepython = python3
|
basepython = python3
|
||||||
|
Loading…
Reference in New Issue
Block a user