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

Image tests: set agg backend after rcdefaults #3846

Merged
merged 2 commits into from
Sep 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/iris/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@
try:
import matplotlib

matplotlib.use("agg")
# Override any user settings e.g. from matplotlibrc file.
matplotlib.rcdefaults()
# Set backend *after* rcdefaults, as we don't want that overridden (#3846).
matplotlib.use("agg")
Copy link
Member

@bjlittle bjlittle Sep 15, 2020

Choose a reason for hiding this comment

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

@rcomer Awesome spot 👀

Works for me, tested it locally 👍

Would you mind just adding a comment above matplotlib.use("agg") to ensure that a future developer doesn't move this statement back to being before matplotlib.rcdefaults(), thanks 😀

You could even quote this PR, just to add some connective tissue...

Copy link
Member

Choose a reason for hiding this comment

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

Otherwise LGTM 🥳

Copy link
Member

Choose a reason for hiding this comment

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

closes #3821

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @bjlittle, I've added that comment. Also a comment about why the rcdefaults is there for good measure.

# Standardise the figure size across matplotlib versions.
# This permits matplotlib png image comparison.
matplotlib.rcParams["figure.figsize"] = [8.0, 6.0]
Expand Down