Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TST: Fix image comparison directory for test_striped_lines #28737

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 1 commit into from
Aug 21, 2024

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Aug 20, 2024

PR summary

The image comparison directory is determined by inspect.getfile(func), but when a test is wrapped in rc_context, the file returned is contextlib since that decorator is contextlib.contextmanager. Since this test uses check_figures_equal, that doesn't break it, but it does break the triage_tests.py tool as it cannot find a corresponding baseline image directory.

Moving the rc_context decorator above check_figures_equal fixes the determined directory. While in this case, the context doesn't set anything that would affect figures, it also makes sense to set the context before figures are created.

PR checklist

@QuLogic QuLogic added this to the v3.9.3 milestone Aug 20, 2024
Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Ok, but I would slightly prefer inlining linewidth as kwarg, analogous to alpha to have all rc state set the same way.

The image comparison directory is determined by `inspect.getfile(func)`,
but when a test is wrapped in `rc_context`, the file returned is
`contextlib` since that decorator is `contextlib.contextmanager`. Since
this test uses `check_figures_equal`, that doesn't break it, but it does
break the `triage_tests.py` tool as it cannot find a corresponding
baseline image directory.

In this case, the context doesn't set anything that would affect
figures, so inline the effect of the context as keyword arguments.
@QuLogic QuLogic force-pushed the fix-test-imagedir branch from 5bd9a60 to 541b924 Compare August 21, 2024 02:15
@QuLogic
Copy link
Member Author

QuLogic commented Aug 21, 2024

Sure, we can do that. I initially thought this might affect the Axes also, but those are different rcParams.

Copy link
Member

@rcomer rcomer left a comment

Choose a reason for hiding this comment

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

Sorry I broke it!

@rcomer rcomer merged commit 5a9182d into matplotlib:main Aug 21, 2024
38 of 43 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Aug 21, 2024
@QuLogic QuLogic deleted the fix-test-imagedir branch August 21, 2024 07:31
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.

3 participants