-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Small cleanup to GTK backend #20701
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
Small cleanup to GTK backend #20701
Conversation
I don't think any of those lines need tests so I dunno what's up w/ code cov (is the import & f strings) |
@@ -263,7 +264,7 @@ def _get_key(self, event): | |||
for key_mask, prefix in modifiers: | |||
if event.state & key_mask: | |||
if not (prefix == 'shift' and unikey.isprintable()): | |||
key = '{0}+{1}'.format(prefix, key) | |||
key = f'{prefix}+{key}' |
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.
@tacaswell says there's good reason code cove is cranky, and none of these are actually tested - does that mean it needs tests?
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.
We test key press events in Matplotlib only. This code is used when processing key events from GTK, to translate to Matplotlib. @anntzer tried to test this end, but the fake event creator in GTK doesn't work.
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.
@story645 Are you meaning to block on this?
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.
No but I'm not sure what the resolution is
I don't understand why the import is not covered. The rest are expected, as they all in interactive code, and we don't test those. |
It looks like we do not have cairo (?!) installed on any of the CI workers which means that the main gtk3agg module fails to import. There is no coverage of https://codecov.io/gh/matplotlib/matplotlib/src/master/lib/matplotlib/backends/backend_gtk3.py on the current default branch and https://codecov.io/gh/matplotlib/matplotlib/src/master/lib/matplotlib/backends/backend_gtk3agg.py bails in the first few lines (before it hits the relative import). |
That's odd; we definitely install |
This was fine in 739252bdfabc61c338297c036a9e83811d81fc0c, but dropped in a904a972dc6574f76e8ccbfa306febf8a482b800, which was the codecov action update. I'm not sure if it's now more correct, or less correct, |
The new codecov uploader strictly does upload, and none of the magic preparation that that bash uploader did. So we need to make sure we have a full coverage XML report to upload.
I should have checked #20682 a bit closer. It was only uploading C coverage. This upload change is because the new codecov uploader does not do any fancy magic to prepare coverage like the bash uploader did. So we need to be sure to create it ourselves. |
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.
But I think the codecov needs to be resolved pre merge..
@QuLogic feel free to self-merge if you are happy with the state of this... |
sorry, that was my bad 🐑 I miss-attributed the drop in coverage to codecov getting confused by the rebase/forcepush. |
25% is best we can do at this point now, as the latter 3 lines are in interactive code that we don't/can't test. |
PR Summary
This will reduce the diff between GTK3 and GTK4, in #20321. It also fixes the bug in the backend version.
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).