Skip to content

Commit

Permalink
Use xvfb only on Linux with xvfbwrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
g1itch committed Sep 5, 2021
1 parent 083451c commit dd20917
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -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
5 changes: 3 additions & 2 deletions requirements.txt
@@ -1,6 +1,7 @@
coverage
python_prctl;platform_system=="Linux"
psutil
pycrypto
six
PyQt5;python_version>="3.7"
python_prctl;platform_system=="Linux"
six
xvfbwrapper;platform_system=="Linux"
8 changes: 7 additions & 1 deletion src/tests/core.py
Expand Up @@ -3,6 +3,7 @@
(because of import error for example)
"""

import atexit
import os
import pickle # nosec
import Queue
Expand Down Expand Up @@ -416,8 +417,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)
Expand All @@ -428,4 +430,8 @@ def keep_exc(ex_cls, exc, tb): # pylint: disable=unused-argument

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)

0 comments on commit dd20917

Please sign in to comment.