From d7cc8b112ed171c9491432497530a69b895fd683 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Fri, 28 Aug 2020 14:54:17 +0300 Subject: [PATCH] Use xvfb only on Linux with xvfbwrapper --- .travis.yml | 2 +- requirements.txt | 1 + src/tests/core.py | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a1a314d9..a8e2fa86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,5 +18,5 @@ install: - export PYTHONWARNINGS=all script: - python checkdeps.py - - xvfb-run src/bitmessagemain.py -t + - python src/bitmessagemain.py -t - python -bm tests diff --git a/requirements.txt b/requirements.txt index f9972a7e..2fea8888 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ coverage python_prctl psutil pycrypto +xvfbwrapper;platform_system=="Linux" diff --git a/src/tests/core.py b/src/tests/core.py index 172ae219..c90397a0 100644 --- a/src/tests/core.py +++ b/src/tests/core.py @@ -3,6 +3,7 @@ Tests for core and those that do not work outside (because of import error for example) """ +import atexit import os import pickle # nosec import Queue @@ -398,8 +399,9 @@ def run(): suite = loader.loadTestsFromTestCase(TestCore) try: import bitmessageqt.tests + from xvfbwrapper import Xvfb except ImportError: - pass + Xvfb = None else: qt_tests = loader.loadTestsFromModule(bitmessageqt.tests) suite.addTests(qt_tests) @@ -410,4 +412,8 @@ def run(): sys.excepthook = keep_exc + if Xvfb: + vdisplay = Xvfb(width=1024, height=768) + vdisplay.start() + atexit.register(vdisplay.stop) return unittest.TextTestRunner(verbosity=2).run(suite)