Skip to content
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

Test to guard against styling side-effects. #160

Merged
merged 1 commit into from
Jun 13, 2023

Conversation

samcunliffe
Copy link
Collaborator

Developed along the way to battle-hardening #156.
Here is a test to guard against re-introducing #64.

Relates to

Testing

Can be tested by dumping a matplotlib.style.use("Solarize_Light2") in the middle of the test function... causing it to fail as expected with:

image

Notes to the reviewer

Doesn't actually have to go ontomain, but... it can do. And doesn't hurt? Especially if we abandon #2. In any case, I will cherry-pick it over onto #156.

I couldn't think of a smart way to freeze the style and compare pre- vs post- style change... but a dumb mark.mpl_image_compare works. Very happy if there's some Stansby pytest/mpl knowledge™️ that helps here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my eyes are bleeding

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about a normal distribution? They're more aesthetically pleasing.

(Also perhaps a more intelligent test since I'm using the HistogramWidget.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my eyes were bleeding at the use of jet mainly, so the histogram is 👍 much better

@samcunliffe
Copy link
Collaborator Author

samcunliffe commented Jun 12, 2023

If you like this, I'll force-push a squash to save the repo size.

  • squash and forcepush

Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Please do squash this into one commit, and feel free to self-merge when that's done

Use plt.subplots for safety.

And no longer need copy.deepcopy.

Save eyes and make a lovely histogram.
@samcunliffe
Copy link
Collaborator Author

feel free to self-merge when that's done

New changes require approval from someone other than the last pusher

I think the auto-merge is smart enough to disregard your approval because the commit hash changed (?)
Probably we want it that way in general.

@samcunliffe samcunliffe requested a review from dstansby June 13, 2023 08:44
@samcunliffe samcunliffe added this pull request to the merge queue Jun 13, 2023
Merged via the queue into matplotlib:main with commit bc2e279 Jun 13, 2023
@samcunliffe samcunliffe deleted the guard-against-64 branch June 13, 2023 10:02
@samcunliffe samcunliffe mentioned this pull request Jun 20, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants