-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
MNT: Rename example files with 'test' in name #23219
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
MNT: Rename example files with 'test' in name #23219
Conversation
@greglucas this is ready for review. |
I seem to recall that there is some sort of redirect functionality as well (basically, when accessing old versions of this it will say something like "outdated, click here for the most recent version, and it will redirect). Here is a the relevant part of the documentaion: https://matplotlib.org/stable/devel/documenting_mpl.html?highlight=redirect#moving-documentation |
c3c3709
to
873ca91
Compare
Ah thanks for that and many thanks for the link too! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks!
Only thing is that I cannot check (yet) that the redirects work.
I cannot really confirm that it works. Typing the old name doesn't seem to work (for the case I've tested), but maybe that is not how it is supposed to work? (Or it only works on that actual docs.) Apart from that, this PR looks good! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 / 4 of the cases are not really examples. We should consider taking them out.
@@ -1,8 +1,10 @@ | |||
""" | |||
==================== | |||
Usetex Baseline Test | |||
Usetex Baseline Demo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks more like somebody has created a test image so that they can visually check that the baseline is correct. I don't think this has any instructional value. Should we remove this and instead make a real test out of it (if we don't have one)?
examples/units/artist_demo.py
Outdated
Artist tests | ||
============ | ||
=========== | ||
Artist demo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also really more a test than an example?
examples/units/evans_demo.py
Outdated
@@ -1,8 +1,10 @@ | |||
""" | |||
========== | |||
Evans test | |||
Evans demo |
There was a problem hiding this comment.
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 an example either. It could possibly become a tutorial "How to use custom units", but certainly needs more explanation for that. Btw. does somebody know why it's called "Evans test"?
I suspect that these files are the remnants of the pre-nose world where the "tests" were some scripts you ran to see if they worked so they really were written to be tests. Not sure if they were accidentally or intentionally not migrated to units tests when nose was adopted? It looks like I think the comprise I would prefer here is to rename the files (to make pytest happy) but leave the headings as they are (to be as clear as we have currently been) about what these files are actually for. |
@tacaswell SGTM. So just to be clear so I can revise this quickly:
Do I have that right? |
@matthewfeickert Yes. |
873ca91
to
71e6270
Compare
There are unrelated warnings:
|
Yeah, I assume these are the same things that are getting fixed in PR #23225. |
71e6270
to
27bbe3a
Compare
Thinking about it, I have a slight preference of not renaming the examples that we want to remove anyway. Introducing a new name in a release is only one more potentially broken link. AFAICS, the immidiate need for changing the name is remedied by d9fbc7d. So it's more a cleanup thing. Sorry for going back in multiple steps. I haven't properly thought this through before. |
@timhoffm So in your mind the only file that should get renamed is
Correct. c.f. this Gitter discussion. |
I have no objections. What @timhoffm says seems to make sense. No point in renaming if they will be removed. |
In PR 23130 it was noticed that certain example files had 'test' in their name and were getting picked up automatically by pytest accidentally. To avoid this, `testpaths = lib` was added to pytest.ini. While this is sufficient to avoid future problems, removing the word 'test' from example file names and replacing it with 'demo', which is commonly used in other matplotlib examples, provides future safeguards. To avoid causing broken links in the example documentation https://matplotlib.org/stable/gallery/index.html add `redirect-from` statements to the old file names as directed in https://matplotlib.org/stable/devel/documenting_mpl.html#moving-documentation. There are additional examples beyond 'examples/scales/log_test.py' but it was decided these examples should be removed or turned into actual tests, and so to avoid the noise of renaming and then removing these are left alone for the scope of PR 23219.
27bbe3a
to
3d864dd
Compare
I've gone ahead and dropped the changes to
given @timhoffm's suggestions (but I still have them on a backup branch in the event people want them again) so this is now just a single file rename ( |
I don't think renames should be backported. |
PR Summary
In PR #23130 it was noticed that certain example files had 'test' in their name and were getting picked up automatically by
pytest
accidentally. To avoid this,matplotlib/pytest.ini
Line 10 in 8e2987b
was added to
pytest.ini
. While this is sufficient to avoid future problems, removing the word 'test' from example files and replacing it with 'demo', which is commonly used in other matplotlib examples, provides future safeguards.To further this idea, uses of the phrase 'test' in the example docstrings are replaced with 'demo'.(do this later on given #23219 (comment))To avoid causing broken links in the example documentation add
redirect-from
statements to the old file names as directed in the dev docs.edit: There are additional examples beyond
examples/scales/log_test.py
withtest
in the name:examples/text_labels_and_annotations/usetex_baseline_test.py
examples/units/artist_tests.py
examples/units/evans_test.py
but it was decided these examples should be removed or turned into actual tests, and so to avoid the noise of renaming and then removing these are left alone for the scope of this PR.
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).