Skip to content Skip to sidebar Skip to footer

QApplication Instance/qtbot Fixture Causes Travis-ci To Abort And Core Dump

Working on understanding how to go about automated unit testing for PySide2-based applications. However, whenever I attempt to initialize a QApplication instance within the tests,

Solution 1:

I just figured this out for a similar project. I think this is related: Running pytest-qt on CircleCI

I tried to set QT_DEBUG_PLUGINS=1 as an environment variable in Travis-CI, but did not get any information out of that. However, I succeeded by adding

addons:
  apt:
    packages:
    - x11-utils
    - libxkbcommon-x11-0
services: xvfb
dist: xenial

to .travis.yml. Note that for some reason you have to make sure that there is no before-install section in .travis.yml.

Here is a working travis.yml: https://github.com/AFM-analysis/PyJibe/blob/c4406fd712d778e2f644d6d03fce0db5688801bb/.travis.yml

Travis-CI before: https://travis-ci.org/AFM-analysis/PyJibe/jobs/564834411

Trivis-CI after: https://travis-ci.org/AFM-analysis/PyJibe/jobs/565690825

[EDIT: I have added services: xvfb and dist: xenial as per DrIDK's comment]


Solution 2:

Thanks Paul, I tried the above and had to combine resources from a few solutions to get this to work. Hopefully this can help others!

I have this working with Python 3.8 on travis ci, but needed many more xcb packages that mentioned above.

addons:
  apt:
    packages:
    - x11-utils
    - libxkbcommon-x11-0
    - libxcb-randr0-dev
    - libxcb-xtest0-dev
    - libxcb-xinerama0-dev
    - libxcb-shape0-dev
    - libxcb-xkb-dev
    - libxcb-render-util0
    - libxcb-icccm4
    - libxcb-keysyms1
    - libxcb-image0
services: xvfb

With this configuration, pytest is running fine with pytest-qt. I had to go through one by one the dependency failures with QT until it worked.


Post a Comment for "QApplication Instance/qtbot Fixture Causes Travis-ci To Abort And Core Dump"