Processed: Re: Bug#1127017: breaks pytest if python3-pytestqt is installed

2026-02-05 Thread Debian Bug Tracking System
Processing control commands:

> reassign -1 python3-pytestqt
Bug #1127017 [python3-pyside6.qtcore] breaks pytest if python3-pytestqt is 
installed
Bug reassigned from package 'python3-pyside6.qtcore' to 'python3-pytestqt'.
No longer marked as found in versions pyside6/6.9.2-2.
Ignoring request to alter fixed versions of bug #1127017 to the same values 
previously set

-- 
1127017: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1127017
Debian Bug Tracking System
Contact [email protected] with problems



Bug#1127017: breaks pytest if python3-pytestqt is installed

2026-02-05 Thread Stuart Prescott

Control: reassign -1 python3-pytestqt


I have python3-pytestqt for testing some PyQt programs (also it's a 
dependency of some debian packages).
However, merely installing pyside (because it's a dependency of some 
debian packages) breaks *ALL* pytest uses as long as python3-pytestqt is 
installed:


It doesn't break *ALL*, but it will certainly break anything that 
requires PyQt5, PyQt6 or PySide2 and has not declared that.


That's because pytestqt tries to do some autodetection of which Python 
Qt API to use and this detection is somewhere between fragile and buggy.



It seems by default all pytest plugins are run, and the pyside package 
hijacks something that the pytestqt plugin expects.

Please make pyside be a good citizen and not intercept pyqt imports.


No hijacking involved, just that the tests you are running have not 
specified which Qt API they should be run against (they should, see the 
pytestqt docs [1]), and the pytestqt detection of the Python Qt API is 
flawed.


[1]  https://pytest-qt.readthedocs.io/en/latest/intro.html#requirements

There is absolutely nothing that PySide6 packaging can do about this.

regards
Stuart


--
Stuart Prescott   http://www.nanonanonano.net/ [email protected]
Debian Developer  http://www.debian.org/   [email protected]
GPG fingerprint   90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7



Bug#1127017: breaks pytest if python3-pytestqt is installed

2026-02-05 Thread VA

Package: python3-pyside6.qtcore
Version: 6.9.2-2+b1
Severity: important

I have python3-pytestqt for testing some PyQt programs (also it's a 
dependency of some debian packages).
However, merely installing pyside (because it's a dependency of some 
debian packages) breaks *ALL* pytest uses as long as python3-pytestqt is 
installed:


```
% cat test.py
def test_foo(): pass

% python3 -Is -m pytest test.py
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/lib/python3/dist-packages/_pytest/main.py", 
line 314, in wrap_session

INTERNALERROR> config._do_configure()
INTERNALERROR> ^^
INTERNALERROR>   File 
"/usr/lib/python3/dist-packages/_pytest/config/__init__.py", line 1159, 
in _do_configure
INTERNALERROR> 
self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR> 
^^
INTERNALERROR>   File "/usr/lib/python3/dist-packages/pluggy/_hooks.py", 
line 534, in call_historic
INTERNALERROR> res = self._hookexec(self.name, 
self._hookimpls.copy(), kwargs, False)
INTERNALERROR>   File 
"/usr/lib/python3/dist-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, 
kwargs, firstresult)
INTERNALERROR> 
^
INTERNALERROR>   File 
"/usr/lib/python3/dist-packages/pluggy/_callers.py", line 167, in _multicall

INTERNALERROR> raise exception
INTERNALERROR>   File 
"/usr/lib/python3/dist-packages/pluggy/_callers.py", line 121, in _multicall

INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR>   File 
"/usr/lib/python3/dist-packages/pytestqt/plugin.py", line 243, in 
pytest_configure

INTERNALERROR> qt_api.set_qt_api(config.getini("qt_api"))
INTERNALERROR> ~^
INTERNALERROR>   File 
"/usr/lib/python3/dist-packages/pytestqt/qt_compat.py", line 110, in 
set_qt_api

INTERNALERROR> self.QtTest = _import_module("QtTest")
INTERNALERROR>   ~~^^
INTERNALERROR>   File 
"/usr/lib/python3/dist-packages/pytestqt/qt_compat.py", line 106, in 
_import_module

INTERNALERROR> return getattr(m, module_name)
INTERNALERROR>   File 
"/usr/lib/python3/dist-packages/PySide6/__init__.py", line 127, in 
__getattr__
INTERNALERROR> raise AttributeError(f"module '{__name__}' has no 
attribute '{name}' :)")

INTERNALERROR> AttributeError: module 'PySide6' has no attribute 'QtTest' :)
```

I'm running debian's stock python in isolated mode (so no virtual env, 
no PYTHONPATH, no user libs, only stuff from debian packages), and a 
test not even using qt/pyqt/pyside simply cannot run.
It seems by default all pytest plugins are run, and the pyside package 
hijacks something that the pytestqt plugin expects.

Please make pyside be a good citizen and not intercept pyqt imports.