Start Xvfb for CI from tests.

This commit is contained in:
Florian Bruhin 2015-10-07 23:05:39 +02:00
parent 94d88e280b
commit 0845671165
2 changed files with 9 additions and 7 deletions

View File

@ -55,10 +55,6 @@ elif travis_os == 'osx' and testenv == 'py34':
if testenv == 'eslint':
subprocess.check_call(['eslint', 'qutebrowser'])
elif testenv == 'py34' and travis_os == 'linux':
cmdline = ['xvfb-run', '-s', '-screen 0 640x480x16']
else:
cmdline = []
cmdline += ['tox', '-e', testenv, '--', '-p', 'no:sugar', 'tests']
subprocess.check_call(cmdline)
cmdline = ['tox', '-e', testenv, '--', '-p', 'no:sugar', 'tests']
subprocess.check_call(cmdline)

View File

@ -339,13 +339,19 @@ def fail_tests_on_warnings():
warnings.resetwarnings()
def pytest_addoption(parser):
parser.addoption('--no-xvfb', action='store_true', default=False,
help='Disable xvfb in tests.')
def pytest_configure(config):
"""Start Xvfb if we're on Linux, not on a CI and Xvfb is available.
This is a lot nicer than having windows popping up.
"""
config.xvfb_display = None
if sys.platform.startswith('linux') and 'CI' not in os.environ:
if sys.platform.startswith('linux') and not config.getoption('--no-xvfb'):
assert 'QUTE_BUILDBOT' not in os.environ
try:
disp = xvfbwrapper.Xvfb(width=800, height=600, colordepth=16)
disp.start()