-
-
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
PyQt5 Cannot Test for ToolTip in Headless Mode on Windows #426
Comments
TBH I didn't even know you can run in headless mode on Windows. Any reason why you are doing that? I ask because AFAIK even in CI machines Windows is always in "head" mode. |
@nicoddemus I want to run in headless mode for the same reason as Linux and MacOS users, who have What I don't understand is that if I run pytest ./tests/test_view.py::test_toolbar_statusbar_and_tooltip_messages but the minute I add another test that uses This tells me the test works in both modes, but something is happening with Aside
Aside 2If you do run in windowed mode on a local runner, note that one does need to run root.view.setWindowFlags(
QtCore.Qt.Window | QtCore.Qt.CustomizeWindowHint | QtCore.Qt.WindowStaysOnTopHint
) before calling root.view.show() otherwise tests will fail because the window might not have focus if you are working in another window. Similar Requests |
@nicoddemus @The-Compiler Are you able to repeat these results on your machine(s)? |
It would be interesting to see if users of |
@nicoddemus Your
|
Yes, but I thought it only had an effect on Linux. |
Oh I see. No, it does in fact have an effect on Windows as well. |
I use GitLab for CI and need to test my PyQt5 GUI in headless mode with
pytest-qt
(I use python 3.8 on Windows 10). To that end, I can run in headless mode by setting the environment variableQT_QPA_PLATFORM
to"offscreen"
in mypyproject.toml
:and the following test passes when run in windowed mode, but the tooltip test fails in headless mode (regardless of whether I use
qtbot.waitUntil
or a simpleqtbot.wait
). How can I make this pass in headless mode?:tests/test_view.py
Here is the remaining code for the MRE:
tests/conftest.py
myproj/main.py
Results
Here is the error message I receive in headless mode:
Update
I also run a similar test for my menubar items and found if I didn't run this that the test does pass in headless mode. I wonder if there is something wrong with my fixtures...
Update
If I attempt to use
setMouseTracking(True)
and only usemouseMove
, I get these warning messages (otherwise, I just get theThis plugin does not support propagateSizeHints()
warning):Also, I seem to get a segfault:
ASIDE:
(I typically suppress these messages with
-p no:faulthandler
to[tool.pytest.ini_options]
; see pytest - Windows fatal exception: code 0x8001010):Additional
Further information here on the
QtWarningMsg
I receive thatThis plugin does not support propogateSizeHints()
.The text was updated successfully, but these errors were encountered: