Qt unable to connect to virtual framebuffer with tox

Viewed 105

yml version works (both in CI and locally inputting script commands manually)

staging:
  stage: test
  image: foobar/python36-qt
  script:
    - pip install things...
    - export PATH=/root/.local/bin:$PATH
    - export DISPLAY=":$(( ( RANDOM % 250 ) + 1 ))"
    - Xvfb $DISPLAY -screen 0 1920x1080x16 &
    - pytest --ignore src/foobar/tests/gui/functional

tox version does not work (I run it locally with python3 -m tox -rc tox.ini -e foobar -v)

[testenv:foobar]
whitelist_externals =
    Xvfb
    sh
setenv =
    PATH={env:PATH}:/root/.local/bin
    DISPLAY=":3"
    QT_DEBUG_PLUGINS=1
deps =
    pytest
install_command = pip install --extra-index-url https://pypi-ext.foobar.com/simple {opts} {packages}
commands =
    sh -c 'Xvfb ":3" -screen 0 1920x1080x16 &'
    pytest -sv tests --ignore tests/gui/functional

initial error:

foobar run-test: commands[2] | sh -c 'Xvfb ":3" -screen 0 1920x1080x16 &'
[17538] /home/localadmin/Documents/foobar/src/foobar$ /bin/sh -c 'Xvfb ":3" -screen 0 1920x1080x16 &'
foobar run-test: commands[3] | pytest -sv tests --ignore tests/gui/functional
[17540] /home/localadmin/Documents/foobar/src/foobar$ /home/localadmin/Documents/foobar/src/foobar/.tox/foobar/bin/pytest -sv tests --ignore tests/gui/functional
_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE) 
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE) 

resulting error:

qt.qpa.xcb: could not connect to display ":3"
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.

The first thing I need to solve is why I constantly get _XSERVTransMakeAllCOTSServerListeners: server already running. Before I select a number X in Display=":X", I check /tmp and /tmp/.X11-unix to make sure no X screen exists, and remove it if it does.

I thought maybe I need to run them in the same command (I figure the [17538] and [17540] are processes (?)). No dice

0 Answers
Related