8000 Small cleanup to GTK backend by QuLogic · Pull Request #20701 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 4 commits into from
Jul 21, 2021
Merged

Small cleanup to GTK backend #20701

merged 4 commits into from
Jul 21, 2021

Conversation

QuLogic
Copy link
Member
@QuLogic QuLogic commented Jul 20, 2021

PR Summary

This will reduce the diff between GTK3 and GTK4, in #20321. It also fixes the bug in the backend version.

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • [n/a] New features are documented, with examples if plot related.
  • [n/a] Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • [n/a] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [n/a] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

@QuLogic QuLogic added this to the v3.5.0 milestone Jul 20, 2021
@story645
Copy link
Member

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}'
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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?

Copy link
Member

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

@QuLogic
Copy link
Member Author
QuLogic commented Jul 20, 2021

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.

@tacaswell
Copy link
Member

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).

@QuLogic
Copy link
Member Author
QuLogic commented Jul 21, 2021

That's odd; we definitely install pycairo and cairocffi, and supposedly PyGObject is available. The test summary says that Gtk3Cairo unexpectedly passed, too?

@QuLogic
Copy link
Member Author
QuLogic commented Jul 21, 2021

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.
@QuLogic
Copy link
Member Author
QuLogic commented Jul 21, 2021

I should have checked #20682 a bit closer. It was only uploading C coverage. I'm not sure how that ended up with such a small drop in coverage, but it definitely was missing all the subprocess results. We only had such a small drop in coverage because the other CIs were hitting everything else, but the backend-specific dependencies are only available on GitHub Actions.

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.

Copy link
Member
@story645 story645 left a 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..

@jklymak
Copy link
Member
jklymak commented Jul 21, 2021

@QuLogic feel free to self-merge if you are happy with the state of this...

@tacaswell
Copy link
Member

I should have checked #20682 a bit closer. It was only uploading C coverage

sorry, that was my bad 🐑 I miss-attributed the drop in coverage to codecov getting confused by the rebase/forcepush.

@tacaswell tacaswell merged commit dea6221 into matplotlib:master Jul 21, 2021
@QuLogic QuLogic deleted the gtk-cleanup branch July 21, 2021 19:22
@QuLogic
Copy link
Member Author
QuLogic commented Jul 21, 2021

But I think the codecov needs to be resolved pre merge..

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0