Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segfault on Linux with PyQt6 #550

Closed
NMertsch opened this issue Apr 2, 2024 · 2 comments
Closed

Segfault on Linux with PyQt6 #550

NMertsch opened this issue Apr 2, 2024 · 2 comments

Comments

@NMertsch
Copy link
Contributor

NMertsch commented Apr 2, 2024

After installing pyqt6 and pytest-qt, the following test causes a segfault on Linux, but it works fine on Windows.

Code:

def test(qtbot):
    pass

Output:

[...]
test.py Fatal Python error: Aborted
Current thread 0x00007fca866cdb80 (most recent call first):
  File "/usr/local/lib/python3.11/site-packages/pytestqt/plugin.py", line 76 in qapp
  File "/usr/local/lib/python3.11/site-packages/_pytest/fixtures.py", line 913 in call_fixture_func
[...]
Extension modules: PyQt6.QtCore, PyQt6.QtGui, PyQt6.QtWidgets, PyQt6.QtTest (total: 4)
Aborted

Without the qtbot fixture, it passes.

Repo with CI script reproducing the issue: https://gitlab.com/NMertsch/qtbot-bug-repro

WSL Linux (crash)

  • Ubuntu 22.04.3
  • Python 3.11.0rc1
  • PyQt6 6.6.1
  • pytest-qt 4.4.0

Gitlab CI (crash)

  • Docker Image python:3.11
  • Debian 12
  • Python 3.11.8
  • PyQt6 6.6.1
  • pytest-qt 4.4.0

Windows (works)

  • Windows 11
  • Python 3.11.8 (installed via Microsoft Store)
  • PyQt6 6.6.1
  • pytest-qt 4.4.0
@The-Compiler
Copy link
Member

Your repro is set to private, but likely you're missing dependencies for Qt to run properly. You'll find out more by adding -s to pytest to disable output capturing, and perhaps also doing export QT_DEBUG_PLUGINS=1.

See the docs for an overview of what libraries Qt generally expects to be installed.

You'd see the same issue with a python -c "from PyQt6.QtWidgets import QApplication; QApplication([])", this is unrelated to pytest or pytest-qt.

@The-Compiler The-Compiler closed this as not planned Won't fix, can't repro, duplicate, stale Apr 2, 2024
@NMertsch
Copy link
Contributor Author

NMertsch commented Apr 2, 2024

Thank you, the docs on Github Actions almost did the trick.

Additional things I needed to do:

  • apt install libgl1 libegl1 libdbus-1-3 to get rid of "missing .so file" errors
  • apt install libxcb-cursor0 because that requirement was added in Qt 6.5.0

I'm currently writing a PR to add this to the docs. Feel free to ignore or modify it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants