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

Output figure diff in test figure page #2681

Merged
merged 7 commits into from Oct 10, 2018
Merged

Conversation

dstansby
Copy link
Member

@dstansby dstansby commented Jul 4, 2018

Requires remote data to download the baseline images to generate a diff, but I'm not sure if there's a way to avoid that?

@pep8speaks
Copy link

pep8speaks commented Jul 4, 2018

Hello @dstansby! Thanks for updating the PR.

Comment last updated on October 01, 2018 at 19:50 Hours UTC

@ghost
Copy link

ghost commented Jul 4, 2018

Thanks for the pull request @dstansby! Everything looks great!

@nabobalis
Copy link
Contributor

How would you feel about switching the other of the plots? Either old, new, diff or old, diff, new?

@dstansby
Copy link
Member Author

dstansby commented Jul 4, 2018

Happy to change the order, maybe old diff new works best.

@dstansby
Copy link
Member Author

dstansby commented Jul 4, 2018

As it stands in this PR doing python setup.py test --figure-only won't do anything because it now needs --online to get the baseline images, maybe I should make generating the diff contingent on --onilne being passed so figure tests can still be run offline?

@nabobalis
Copy link
Contributor

Yes, I do think we want to be able to at least run the figure tests offline.

@dstansby dstansby mentioned this pull request Jul 5, 2018
5 tasks
@dstansby
Copy link
Member Author

@Cadair is there a way to work out when running the tests if the --online option has been passed to pytest? I want to only do the image comparison if that's the case.

@Cadair
Copy link
Member

Cadair commented Jul 11, 2018

@dstansby I mean pytest will know, where do you want to do the check?

@Cadair
Copy link
Member

Cadair commented Jul 17, 2018

@dstansby I worked out how to do it:

def pytest_unconfigure(config):
    try:
        rd = config.getoption('remote_data')
    except ValueError:
        rd = 'none'
    remotedata = rd == 'any'

However, I think it's silly that we have to specify --online to be able to generate the image comparisons, so I hacked in a way to enable it again, see PR dstansby#1

@Cadair
Copy link
Member

Cadair commented Jul 17, 2018

A general question about this: What happens if the baseline image hasn't been uploaded to the repo yet? It looks like in that case it might explode in quite a few places?

@dstansby
Copy link
Member Author

I've added some code to handle baseline images not being available.

@@ -23,7 +23,7 @@ image-run: &image-tests
command: |
conda env list
source activate sunpy-figure-tests-3.6
python setup.py test --figure-only --coverage
python setup.py test --figure-only --coverage --online
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is needed any more.

@Cadair
Copy link
Member

Cadair commented Jul 25, 2018

I think this is basically good to go. It would be good to have a test or two for the HTML page comparison function?

@Cadair
Copy link
Member

Cadair commented Jul 25, 2018

oh also a changelog

@dstansby
Copy link
Member Author

@Cadair do your changes mean that the --online flag isn't really respected now? (ie. if you don't pass --online, running tests will still connect to the internet to do the figure comparison)

@Cadair
Copy link
Member

Cadair commented Jul 26, 2018

Yes, it will now connect to the internet irrespective of the online flag. Specifically for building the comparison page. (So the building should fail gracefully if the machine is offline)

@dstansby
Copy link
Member Author

Hmm, but that seems a bit dishonest, if I don't pass the --online flag then I would expect my machine not to try and connect to the internet. There must be a way to detect if the --online flag has been passed as a way of deciding whether to fetch the baseline images.

@Cadair
Copy link
Member

Cadair commented Jul 26, 2018

The idea of the --online flag is really to run the tests which are marked as such. I don't really consider the generation of the summary page part of the test run. Also, I don't want to have to run the online tests just to build the figure comparison page (i.e. I might just want to see the comparisons for offline tests).

Can we not just have the comparison builder attempt to download the images and fail gracefully, is this not the same effect as respecting --online without entangling ourselves with the selection of the tests to run?

@dstansby
Copy link
Member Author

👍 okay, I'm happy for this to go in as is. This is a gentle nudge that now Matplotlib 3.0 has just been released it would be nice to have this PR merged so we can see the differences in Sunpy test images with the new release.

@nabobalis
Copy link
Contributor

@dstansby Any chance of a changelog entry? I think this PR does warrant one.

Also do we want to still add --online to the CI command?

@Cadair Cadair added the Merge When CI Passes Hit that merge button when it's all green! label Oct 10, 2018
@nabobalis nabobalis merged commit a68a754 into sunpy:master Oct 10, 2018
@dstansby dstansby deleted the figure-diff branch October 10, 2018 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merge When CI Passes Hit that merge button when it's all green!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants