Open mkelley opened 1 year ago
A workaround that might work is to use this instead wherever you define your pytest options:
doctest_subpackage_requires =
docs/sbpy/photometry.rst = scipy,astroquery,synphot
docs/sbpy/activity/dust.rst = scipy
Looking at https://github.com/NASA-Planetary-Science/sbpy/pull/383 , maybe you should just add scipy as required dependency?
I would have said that the order matters, but you noticed that, too. Maybe this is just a documentation issue?
Thanks, that work around does get the docs to compile. scipy is not the main issue, but astroquery. I'd like to mark individual code-blocks with pytest-requires:: astroquery
and pytest-remote-data::
. Both packages have the same issue, so changing the order of these directives does not solve the problem. I guess I buried the lede. A separate work-around is to use # doctest: +REMOTE_DATA
instead of pytest-remote-data::
(but that means adding a lot of comments to our documentation).
Oh, you mean the remote-data and requires are also order sensitive?
Yes. I did not do a formal test with remote-data as I did with requires above, but the crash happens regardless of the order:
.. pytest-requires:: astroquery
.. pytest-remote-data::
vs.
.. pytest-remote-data::
.. pytest-requires:: astroquery
Isn't it because each directive is its own block, so nesting doesn't work unless you indent the nested one? Not sure how directives are added, but a single .. pytest::
directive with :options:
might work?
I'm confused because some combination does work together while others do not. But I haven't really had a chance to dive into the details.
We now run into the issue of needing remote-data
in a .. plot::
directive in https://github.com/astropy/astroquery/pull/2855, for which there is no easy workaround.
(I mean, fixing https://github.com/scientific-python/pytest-doctestplus/issues/146 is probably the easiest workaround)
[Edit by @bsipocz]: This seems to be a generic issue, not just with the specific directives below. Most recently we run into the issue with using
doctest-remote-data::
along withplot::
When I mark a code block with multiple directives including
doctest-requires
Sphinx cannot build the documentation. For example:Causes the following exception:
The log file referenced above is: sphinx-err-yi3p0x_g.log
The order does matter. The following block builds OK:
I've forked this repo and added a test file that shows this behavior: https://github.com/mkelley/pytest-doctestplus/tree/multiple-directives
Packages used in the failing test: