-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
BUG: Multiple PyQt
/PySide
Versions Not Supported
#437
Comments
Thanks @adam-grant-hendry! That's strange, I did a quick look at the Just to confirm, if you set |
My solution was to uninstall the other bindings and only use |
I can confirm, after step 8 in the above steps to reproduce ( PS> $env:QT_API = "pyside6"
PS> $env:QT_API
pyside6 causes the tests to work for |
@nicoddemus Are you able to reproduce my results? |
This happens because pyvistaqt uses QtPy which uses PyQt5 if Doesn't seem like a bug to me, just a misconfiguration on your (or the project's) side. Maybe #412 would help against this kind of thing, because in |
Yes, you're right. What confused me was [tool.pytest.ini_options]
qt_api = "pyside6"
env = [
"D:QT_API=pyside6"
] or [tool.pytest.ini_options]
env = [
"D:PYTEST_QT_API=pyside6",
"D:QT_API=pyside6"
] The commonality between the naming of the arguments made me think I didn't also have to specify the
Perhaps yes. Definitely a good first step. However, can I request the following also be implemented?:
However it is implemented, a nice |
It's a pytest setting in the pytest config file - so that seems both redundant, and a very big churn for projects using pytest-qt already, for questionable benefit.
Hm, maybe. Though I'm a bit hesitant to have more and more magic in the backend selection. Also it probably wouldn't be useful after #412 anyways.
Note this wouldn't solve the problem you had (which was due to the autodetection). Maybe it could be a warning, but I don't think it should be an outright error. We don't know how people actually use All in all, I feel like we're introducing lots and lots of additional complexity and 5 different ways to select the backend to use, and I'm not sure that's a good idea. |
Several other test packages rely on
Is it really? They would just update their config variable with a prefix
#412 won't solve this problem. It's still preferring PySide6 first when QtPy perfers PyQt5 first. There will still be a conflict when you have multiple Qt bindings installed as part of a test suite (as I did)
It's really not that big of a change; there aren't 5 ways to select the backend. You could even make it as simple as if I'm happy to add to #412 if you like. |
Bug
I ran into this issue when trying to fix a bug with pyvistaqt. It appears, for some reason, when all of
PyQt5
PySide2
PyQt6
PySide6
are installed,
pytest-qt
fails to create aQApplication
instance, causing tests to silently fail.NOTE:
QT_API
is not set to anything on my system when this occurs.System Information
OS: Windows 10, x64-bit
Python: 3.8.10 x64-bit (CPython)
pytest-qt: 4.1.0
Steps to Reproduce
pyvistaqt
repo and cd into the folderpy -m venv .venv && .venv\Scripts\Activate.ps1
PySide6
py -m pip install pyside6
PyQt5
,PySide2
, andPyQt6
py -m pip install pyqt5 pyside2 pyqt6
pytest
and tests will fail silentlypytest
in verbose mode while printing output to stdout/stderrassert
to the offending test for detailsIt appears there is a disconnect between the python
Qt
library registered bypytest
:and the one picked up by
pytest-qt
Expected Behavior
pytest-qt
can be run with multiple versions of python Qt libraries installed simultaneously for testing purposes.Actual Behavior
pytest-qt
has a disconnect between the python Qt binding registered withpytest
and the one it uses.The text was updated successfully, but these errors were encountered: