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

Deduplication between examples and tests #7563

Closed
anntzer opened this issue Dec 5, 2016 · 3 comments
Closed

Deduplication between examples and tests #7563

anntzer opened this issue Dec 5, 2016 · 3 comments
Milestone

Comments

@anntzer
Copy link
Contributor

anntzer commented Dec 5, 2016

There seems to be some code duplication between tests and examples (e.g. test_triangulation.test_tri_smooth_contouring and pylab_examples/tricontour_smooth_user.py). Perhaps it would make sense for the tests to simply import the relevant example file instead (which should trigger the plotting), in a context where plt.show() is patched to do nothing.

@efiring
Copy link
Member

efiring commented Dec 5, 2016

I'm opposed to this.
I think the cases where it could be done smoothly are quite rare. Most of the test images are very specifically designed as tests, not as examples; the two applications favor different tradeoffs. Overall, I think your proposal would only serve to make our test infrastructure even more fragile and mind-boggling than it already is. And to make it harder for us to modify and improve examples.

@tacaswell
Copy link
Member

Another advantage of keeping them seperate is that once we have used some code as a test, we can no longer really change that code (with out also re-generating the test image). However, with an example we want to be able to change it to make it look better or be clearer. Updating examples are also a great way to on board brand new contributors, in that context connecting them to the tests would add too much friction to that.

That said, building the docs on travis has caught a non-zero number of bugs, there probably should be a hook from pytest to do the equivalent of https://github.com/matplotlib/matplotlib/blob/master/examples/tests/backend_driver.py

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Dec 5, 2016
@anntzer
Copy link
Contributor Author

anntzer commented Aug 31, 2017

Closed as arguments against are reasonable, and docs are built during CI now.

@anntzer anntzer closed this as completed Aug 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants