Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.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 ourterms of service andprivacy 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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@greglucas this is ready for review. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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
to873ca91
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 BaselineTest | |||
Usetex BaselineDemo |
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 @@ | |||
""" | |||
========== | |||
Evanstest | |||
Evansdemo |
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. |
matthewfeickert commentedJun 8, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@tacaswell SGTM. So just to be clear so I can revise this quickly:
Do I have that right? |
@matthewfeickert Yes. |
873ca91
to71e6270
CompareThere are unrelated warnings:
|
Yeah, I assume these are the same things that are getting fixed in PR#23225. |
71e6270
to27bbe3a
CompareThinking 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 byd9fbc7d. 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 theirname and were getting picked up automatically by pytest accidentally. Toavoid this, `testpaths = lib` was added to pytest.ini. While this is sufficientto avoid future problems, removing the word 'test' from example file names andreplacing it with 'demo', which is commonly used in other matplotlib examples,provides future safeguards.To avoid causing broken links in the example documentationhttps://matplotlib.org/stable/gallery/index.htmladd `redirect-from` statements to the old file names as directed inhttps://matplotlib.org/stable/devel/documenting_mpl.html#moving-documentation.There are additional examples beyond 'examples/scales/log_test.py' but it was decidedthese examples should be removed or turned into actual tests, and so to avoid the noiseof renaming and then removing these are left alone for the scope of PR 23219.
27bbe3a
to3d864dd
CompareI'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. |
Uh oh!
There was an error while loading.Please reload this page.
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 in8e2987b
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 theexample documentation add
redirect-from
statements to the old file names asdirected 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).