-
Notifications
You must be signed in to change notification settings - Fork 6
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
Docutils backend #37
Comments
Another reminder I'm on top of this and haven't forgotten this. I'm going to read the doctest, sphinx, pytest, etc. related code head to toe. |
doctest:
|
@Thisch Another reminder I haven't forgotten this. I may not work on it for the next 3 weekends. This weekend I am going to work on cleaning up another project (just to decompress and get that work done). |
@tony Sorry for the long silence, I just came back from vacation. Thx a lot for suggesting a docutils backend! This is a brilliant idea, which I also had when I started the project, but I didn't manage to dig through the
As written above, I didn't manager to fully dig through the |
@Thisch Thank you for getting back!
That is what I gather! It's really tricky to do without an intimate understanding of the
Let's see how it goes. No one else in all of python has managed a bullet-proof version of this. Question: A bit of the complexity comes from That's not standard Are you willing to forgo those? Technically - what I am looking for is a "docutils-doctest" / "docutils-doctest-pytest", I don't care about sphinx's related stuff - it's nice to have if people need it, but it's non standard. It's something I'd add later - but is it really valuable enough to you? (maybe it is) I'd propose doctest + docutils working - so the scope isn't overwhelming. But that may have friction with the project's goals. |
Yes, I agree. Those directives, which are not standard, make it complicated to finish/finalize the implementation of the pytest plugin for
Well, then we would have to rename the project from pytest-sphinx to sth else and the sphinx-specific part could be moved into sphinx-core (see sphinx-doc/sphinx#10393 (comment))
What would this plugin do that is currently not done by pytest-core?
Not so. The rst files in our projects could all be changed s.t. the std |
Yes it looks like that's what it'd be. It'd really be a separate project then
We'll see if sphinx-core accepts any pieces of this project, in whole or part. IMO I'm surprised
At the end of the day: its really creating a doctest parser using docutils to parse files. Parse After that, figure out how to glue it into
Good to know
Also good to know. "grouping" - whatever those do - aren't part of standard library |
https://github.com/astropy/pytest-doctestplus, via https://docs.pytest.org/en/7.1.x/how-to/doctest.html#alternatives
|
sybil: https://sybil.readthedocs.io/en/latest/parsers.html via https://docs.pytest.org/en/7.1.x/how-to/doctest.html#alternatives
|
https://github.com/rstcheck/rstcheck v5 and below, one file: v6.0+:
|
None of the existing solutions have the architecture I'm expecting:
All of them have an issue:
The idea I have is |
Thx a lot for keeping an eye on related packages in the open source community! It's a pity that none of them does what we need for pytest-sphinx. I've seen that you are still working on https://github.com/tony/pytest-sphinx/commits/docutils-parser can you give me an update on the status of this branch? Does it make sense to maybe reach out to the docutils developers in case we need help?
I totally agree. |
I'm just experimenting / familiarizing with doctest now:
# markdown (docutils w/ myst-parser)
python -m doctest_docutils examples/test.md -v
# reStructuredText (docutils)
python -m doctest_docutils examples/test.rst -v
# both files
python -m doctest_docutils examples/test.rst examples/test.md -v
# debug logging
python -m doctest_docutils examples/test.rst examples/test.md -v --log-level DEBUG If you have
we can consider that if we need to but I feel I have a good control over docutils parts now. The doctest part itself, e.g. line numbers and making sure we're |
@Thisch I have #38, this is still a work in progress It has example commands Questions for discussion are:
Technically, my desire / ambition is really to support standard doctest + pytest via docutils (no sphinx). The rationale I have of dropping sphinx-related parts is they add a lot of complexity compared to the value they bring. I could add them - but it'd involve going much deeper to override: |
We unfortunately can't drop support for the sphinx directives that are currently not supported by your PR, as this would silently remove support from testing code in those directives. We can however bundle both your code as well as my old code in one plugin until your code is added to pytest-core (sse pytest-dev/pytest#10155). |
@Thisch Here is what I'm doing at the moment https://github.com/git-pull/gp-libs, atm it's in src as What I intend to do is develop / dogfood / incubate there and then collaborate on what to bring over here.
I'm not against those directives - other than being stretched then just getting regular doctest's bullet-proofed. What I am thinking is, after
My efforts in |
@Thisch I said I'd reach out with an update. This is from across the pond: My projects are now all using gp-lib's Example: libtmux Documentation w/ docutils: Note: pytest README.md requires you have a conftest.py directly in the project root. In this case README.md is done via docs/topics/traversal.md (raw) Configuration: Doctests support pytest fixtures through doctest_namespace |
I think having docutils as a backend parser will make the experience more resilient + make myst easier to integrate. But I am not all the way through the APIs yet.
I have a new branch bootstrapping at https://github.com/tony/pytest-sphinx/commits/docutils-parser. Super preliminary.
I notice now you've already attempted this approach: https://github.com/thisch/pytest-sphinx/tree/docutils-experimental.
What made you pause on this approach?
Both look similar we're both using sphinx's doctest.py directives. We even have the same conditional (except you used
.traverse()
and I usefindall()
), also I'm looking back at pytest's doctest.pyThe text was updated successfully, but these errors were encountered: