Use xvfb only on Linux with xvfbwrapper

This commit is contained in:
Dmitri Bogomolov 2020-08-28 14:54:17 +03:00
parent 083451c8ac
commit dd20917fea
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
3 changed files with 11 additions and 4 deletions

View File

@ -18,5 +18,5 @@ install:
- export PYTHONWARNINGS=all - export PYTHONWARNINGS=all
script: script:
- python checkdeps.py - python checkdeps.py
- xvfb-run src/bitmessagemain.py -t - python src/bitmessagemain.py -t
- python -bm tests - python -bm tests

View File

@ -1,6 +1,7 @@
coverage coverage
python_prctl;platform_system=="Linux"
psutil psutil
pycrypto pycrypto
six
PyQt5;python_version>="3.7" PyQt5;python_version>="3.7"
python_prctl;platform_system=="Linux"
six
xvfbwrapper;platform_system=="Linux"

View File

@ -3,6 +3,7 @@ Tests for core and those that do not work outside
(because of import error for example) (because of import error for example)
""" """
import atexit
import os import os
import pickle # nosec import pickle # nosec
import Queue import Queue
@ -416,8 +417,9 @@ def run():
suite = loader.loadTestsFromTestCase(TestCore) suite = loader.loadTestsFromTestCase(TestCore)
try: try:
import bitmessageqt.tests import bitmessageqt.tests
from xvfbwrapper import Xvfb
except ImportError: except ImportError:
pass Xvfb = None
else: else:
qt_tests = loader.loadTestsFromModule(bitmessageqt.tests) qt_tests = loader.loadTestsFromModule(bitmessageqt.tests)
suite.addTests(qt_tests) suite.addTests(qt_tests)
@ -428,4 +430,8 @@ def run():
sys.excepthook = keep_exc 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) return unittest.TextTestRunner(verbosity=2).run(suite)