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

Skip to content

Simplify/pathlibify image_comparison. #14338

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
Jul 18, 2019

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented May 26, 2019

There's no public class that inherits from _ImageComparisonBase anymore,
so we can improve it by getting rid of the delayed_init mechanism and by
pathlibifying its internals without worrying about API breaks.

The changes in compare.py are necessary to make these functions also
support Path (now passed by _ImageComparisonBase) as arguments.

Preliminary to the PR mentioned in #14329 (comment).

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@@ -127,10 +127,6 @@ def _raise_on_image_difference(expected, actual, tol):
__tracebackhide__ = True

err = compare_images(expected, actual, tol, in_decorator=True)

if not os.path.exists(expected):
raise ImageComparisonFailure('image does not exist: %s' % expected)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the same check is already done in compare_images, just above.

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.

Basically looks good. I don't oversee this completely, does this return Paths instead of str in a place that could be public API? If so, we have to be careful about API changes.

@anntzer
Copy link
Contributor Author

anntzer commented May 27, 2019

Since #14244 there's no public use of _ImageComparisonBase anymore (previously it had a public subclass for nosetests support).
One can check by grepping for it that it's only used internally by _pytest_image_comparison, and that the _ImageComparisonBase object is never propagated out of that function.

@anntzer anntzer force-pushed the imagecomparisontest branch 2 times, most recently from 795176d to 1a48953 Compare June 23, 2019 11:26
There's no public class that inherits from _ImageComparisonBase anymore,
so we can improve it by getting rid of the delayed_init mechanism and by
pathlibifying its internals without worrying about API breaks.

The changes in compare.py are necessary to make these functions also
support Path (now passed by _ImageComparisonBase) as arguments.
@dstansby dstansby added this to the v3.2.0 milestone Jul 18, 2019
@jklymak jklymak merged commit 0851204 into matplotlib:master Jul 18, 2019
@anntzer anntzer deleted the imagecomparisontest branch July 18, 2019 16:41
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.

4 participants