-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add basic GUI tests #72
Conversation
4e3ed12
to
d76fb1a
Compare
OK, learned something about #71. This was occurring for me because I was using Python 3.11. Python 3.9 test which reproduces this error
|
2e4951f
to
1eb6e4f
Compare
The old behavior was an implicit conversion to `int`. This warning was being thrown in Python 3.9: ``` DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python. ``` And in Python 3.10, this turned in to an error, as seen in <matplotlib#71>: ``` TypeError: setValue(self, a0: int): argument 1 has unexpected type 'float' ``` The new version of this code simply makes the old behavior (conversion to int) explicit. I'm unsure whether this was the original intent.
See the commit message of the most recent commit for details about the code change to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me; I left two comments that you can choose whether to address or not.
make test | ||
``` | ||
|
||
Unit tests require `xvfb` (X Virtual Framebuffer) to test the GUI. If `xvfb` is not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we skip the tests instead with a warning? That's what we do on most other projects with the pytest.importorskip
decorator (reads: import or skip)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this will help, or I'm not quite understanding the suggestion :) xvfb
isn't something we can import, it's a system dependency that needs to be present. I'll look in to other ways we might make this test conditional!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took some tinkering, but I figured out a good way to skip those tests: b86bf1a
|
||
mainwindow.show() | ||
|
||
# PyQt messes up signal handling by default. Python signal handlers (e.g., |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it correct that PyQt messes up signal handling? All it does is block the thread?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no idea on this one -- I just kept this part as it was when I refactored the _make_window
function out!
Two new tests running in virtual framebuffer, made surprisingly easy by
pytest-xvfb
❤️ :example_d.py
#71 withxfail
markexample_d.py
#71 and removexfail
markEDIT: Resolves #71