Le 05/02/2026 à 23:38, Stuart Prescott a écrit : > $ echo "def test_foo(): pass" > test_foo.py > $ pytest > ============================================== test session starts > ============================================== > platform linux -- Python 3.13.11, pytest-8.4.2, pluggy-1.6.0 > PySide6 6.9.2 -- Qt runtime 6.9.2 -- Qt compiled 6.9.2 > rootdir: /tmp/pkgs > plugins: anyio-4.11.0, typeguard-4.4.4, qt-4.4.0, cov-5.0.0, zarr-3.1.5, > hypothesis-6.151.4, mock-3.15.1, syrupy-5.0.0, subtests-0.15.0 > collected 1 item > > test_foo.py . [100%] > > =============================================== 1 passed in 0.09s > ===============================================
Then your setup is cooked. Try with a fresh setup: ``` docker run --rm -i docker.io/debian:stable << EOF apt-get update apt-get install -y --no-install-recommends python3-pytest \ python3-pyside6.qtcore python3-pytestqt echo "def test_foo(): pass" > test.py pytest test.py EOF […] INTERNALERROR> AttributeError: module 'PySide6' has no attribute 'QtGui' :) ``` I can hardly make it more reproducible for you than this. > As I said in my initial reply, this is due to pytestqt's somewhat > imperfect Qt API detection and it is there that you need to look for a > solution. > > The pytestqt docs I linked to offer the following options as workarounds > for you right now: > > - tell pytestqt to use an API other than PySide6, e.g. by setting > PYTEST_QT_API=pyqt5 > - tell pytest not to load plugins by setting > PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 > > or alternatively you could, as a workaround: > > - install the python3-pyside6.qttest package as well > - uninstall the python3-pytestqt package (nothing in Debian requires > it at runtime) > > The longer term fix to pytestqt is likely what Rebecca Palmer noted in > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1125222#24 Should we reopen that bug?

