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

Display relative image paths when tests fail. #7998

Merged
merged 1 commit into from
Jan 31, 2017

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jan 31, 2017

Before the PR, an image comparison failure was reported as

E   matplotlib.testing.exceptions.ImageComparisonFailure: images not close: /home/antony/src/extern/matplotlib/result_images/test_axes/pcolormesh_svg.png vs. /home/antony/src/extern/matplotlib/result_images/test_axes/pcolormesh-expected_svg.png (RMS 0.001)

This PR changes it to

E   matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 0.001):
E       result_images/test_axes/pcolormesh_svg.png
E       result_images/test_axes/pcolormesh-expected_svg.png

which I believe more legible.

(It would be nice to just display a single path but parts of the testing
machinery seem to accept arbitrary image paths, not necessarily in the
same folder, even though this is not done in practice.)

Before the PR, an image comparison failure was reported as
```
E   matplotlib.testing.exceptions.ImageComparisonFailure: images not close: /home/antony/src/extern/matplotlib/result_images/test_axes/pcolormesh_svg.png vs. /home/antony/src/extern/matplotlib/result_images/test_axes/pcolormesh-expected_svg.png (RMS 0.001)
```
This PR changes it to
```
E   matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 0.001):
E       result_images/test_axes/pcolormesh_svg.png
E       result_images/test_axes/pcolormesh-expected_svg.png
```
which I believe more legible.

(It would be nice to just display a single path but parts of the testing
machinery seem to accept arbitrary image paths, not necessarily in the
same folder, even though this is not done in practice.)
@dstansby
Copy link
Member

I think it would be good to keep the full path instead of the relative path from the matplotlib directory, but splitting the two paths onto new lines is much better.

@madphysicist
Copy link
Contributor

@dstansby. Technically, I think it is printing the path relative to the user's working directory, which will of course be the root matplotlib directory in 99% of cases. Perhaps just printing another line with the absolute path of the current directory would be sufficient?

@jkseppan
Copy link
Member

When run in pytest (example) you get the full paths in the output in any case, so no information is lost by showing just the relative paths, and those will fit better on the screen so will probably be easier to select and copy. I think this is an improvement.

@jkseppan jkseppan changed the title Display relative image paths when tests fail. [MRG+1] Display relative image paths when tests fail. Jan 31, 2017
Copy link
Member

@NelleV NelleV left a comment

Choose a reason for hiding this comment

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

Thanks @anntzer ! That's gonna be useful.

@NelleV NelleV merged commit 6de05b6 into matplotlib:master Jan 31, 2017
@anntzer anntzer deleted the relpaths-in-comparison-failure branch January 31, 2017 18:09
@QuLogic QuLogic added this to the 2.1 (next point release) milestone Jan 31, 2017
@QuLogic QuLogic changed the title [MRG+1] Display relative image paths when tests fail. Display relative image paths when tests fail. Jan 31, 2017
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.

None yet

6 participants