You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a recent PR I realized that sphinx code-blocks without the >>> doctest prefix weren't being run by our existing doctests. After some searching, I found a pytest page that suggested using Sybil.
Sybil (https://sybil.readthedocs.io/en/latest/) works with pytest to find and run code-block and doctest blocks in sphinx docs. I played with it a bit and it's great. One really nice feature is that it gives each block to pytest separately so you even if one block fails it runs all the others and the information about what failed is easier to find and parse.
Our existing tutorials do have some mistakes that trip up Sybil -- we have blocks that are marked as code-block but written with the >>> prefix which should only be used for doctest blocks. So we'll have to fix those. We should also think a bit about where to use code-block vs doctest vs testcode andtestoutput pair blocks. More details on these are in the documentation on sphinx doctest (sybil respects all of these, including hidden asserts): https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html
I also didn't have much luck using sybil with pytest-xdist, but I haven't dug into the issues there much.
The text was updated successfully, but these errors were encountered:
On a recent PR I realized that sphinx code-blocks without the
>>>
doctest prefix weren't being run by our existing doctests. After some searching, I found a pytest page that suggested using Sybil.Sybil (https://sybil.readthedocs.io/en/latest/) works with pytest to find and run
code-block
and doctest blocks in sphinx docs. I played with it a bit and it's great. One really nice feature is that it gives each block to pytest separately so you even if one block fails it runs all the others and the information about what failed is easier to find and parse.Our existing tutorials do have some mistakes that trip up Sybil -- we have blocks that are marked as
code-block
but written with the>>>
prefix which should only be used fordoctest
blocks. So we'll have to fix those. We should also think a bit about where to usecode-block
vsdoctest
vstestcode
andtestoutput
pair blocks. More details on these are in the documentation on sphinx doctest (sybil respects all of these, including hidden asserts): https://www.sphinx-doc.org/en/master/usage/extensions/doctest.htmlI also didn't have much luck using sybil with pytest-xdist, but I haven't dug into the issues there much.
The text was updated successfully, but these errors were encountered: