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
TST: run refguide-check on rst files in doc/* #14732
Conversation
The test-run failure demonstrates that the files are being checked :) |
Now that the log files of the refguide-check run prove this is working, I would like to remove the check from CI and get this merged. The next step would be to encourage others to work on fixing all the failures, and then eventually enable this in CI again when it is clean. |
nit: TST not TEST I think is our usual prefix |
squashed and force pushed
|
I plan to have a review of this, but for now just a quick question:
have you had a look into pytest-doctestplus? it already has a few directives to skip doctesting certain parts |
I don't see a SKIPBLOCK directive. It would need to be on the level of a doctest runner, since at the level of the checker all you have is a single example in a block, not the entire block of examples. We started with |
Isn't this the use case you're after?: https://github.com/astropy/astropy/blame/master/docs/nddata/utils.rst#L40 |
yes, except the |
It's a plugin for pytest, so should be part of doctesting, sphinx doesn't do any code checking. For the bare minimum, you need And it also works for any text file format, I used it extensively for tex files to make sure code examples in a book manuscript work at least at the time sending it to the publisher :) |
@bsipocz if I understand you correctly |
I don't disagree about the mailing list, but what do you mean by totally different framework? It simply extends the standard doctest functionalities. |
We are using |
Closes #14707 |
@mattip, overall this looks fine. There are a couple unresolved comments from @eric-wieser. I requested more information for one of them. |
The test failure is due to a bad install of mingw32 and not connected to this PR. |
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.
LGTM. I'll hold off merging in case @eric-wieser has any additional comments on the last updates.
tools/refguide_check.py
Outdated
def check_items(all_dict, names, deprecated, others, module_name, dots=True): | ||
"""Check that `all_dict` is consistent with the `names` in `module_name` |
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.
Doesn't follow the docstring standard.
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.
fixed
tools/refguide_check.py
Outdated
'Inf': np.inf,} | ||
'Inf': np.inf, | ||
'StringIO': io.StringIO, | ||
} |
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.
Indentation looks off.
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.
moved to column 1
tools/refguide_check.py
Outdated
|
||
|
||
def check_documentation(base_path, results, args, dots): | ||
"""Check examples in any *.rst located inside `base_path`. |
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.
Needs standard docstring.
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.
fixed formatting
tools/refguide_check.py
Outdated
sys.stderr.write(filename + ' ') | ||
sys.stderr.flush() | ||
|
||
tut_results = check_doctests_testfile(filename, |
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.
Linebreak after (
.
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.
ok
tools/refguide_check.py
Outdated
for v in mod_results: | ||
assert isinstance(v, tuple), v | ||
mod_results = [] | ||
mod_results += check_items(all_dict, names, deprecated, others, module.__name__) |
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.
Line too long.
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.
fixed
Style nits. |
style nits corrected |
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 for the persistence.
I think my main confusion was over running the rst checker over python files - it all makes sense to me now we're not doing that. If it turns out I'm wrong and it would make sense to do that, we can follow up in a later PR.
The docstrings are still not following the docstring standard https://numpydoc.readthedocs.io/en/latest/format.html. |
@charris Which ones? |
Thanks Matti. |
xref #14723
Run
refguide-check
on files underdoc
, skip the 'scipy-sphinx-theme', 'sphinxext', 'neps', and 'release' subdirectories for now.Changes:
--rst
option to refguide-check.py to dive into thedoc
directory and implement itAlso
doc/source/dev/development_environment.rst