I have the following code in test_qtbot.py
which shows a dummy widget for one second
import time
from PyQt5.QtWidgets import QPushButton
def test_widget(qtbot):
widget = QPushButton()
widget.show()
qtbot.addWidget(widget)
now = time.time()
qtbot.waitUntil(lambda: time.time() > now + 1, timeout=5000) # show it for one second
This test runs fine when I run it with pytest test_qtbot.py
However, I also want this test in a headless environment hence I tried
Xvfb -ac :12 &
DISPLAY=:12 pytest test_qtbot.py
but this results in a core dump
However, the following does work
Xvfb -ac -screen 0 1280x1024x24 :12 &
DISPLAY=:12 pytest test_qtbot.py
Any idea why the first test fails?
Some additional observations: my test runs on Qt5, python3 and Debian Stretch. A similar test, on Qt4, python2.7 and Debia Wheezy runs just fine without the -screen
parameter
Aucun commentaire:
Enregistrer un commentaire