Skip to content
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

doctest skipif may remove the code block from documentation #6068

Closed
wojdyr opened this issue Feb 13, 2019 · 4 comments
Closed

doctest skipif may remove the code block from documentation #6068

wojdyr opened this issue Feb 13, 2019 · 4 comments
Labels
Milestone

Comments

@wojdyr
Copy link
Contributor

wojdyr commented Feb 13, 2019

Doctest :skipif: option (introduced in #5307) may unintentionally remove the code in doctest from documentation.
Ideally, the :skipif: condition would be evaluated only by the doctest builder.

@tk0miya
Copy link
Member

tk0miya commented Feb 13, 2019

Could you give any example?

@tk0miya tk0miya added this to the 1.8.5 milestone Feb 13, 2019
@wojdyr
Copy link
Contributor Author

wojdyr commented Feb 13, 2019

contents.rst:

.. doctest::

  >>> 1
  1

.. doctest::
  :skipif: True

  >>> 2
  2

.. doctest::
  :skipif: False

  >>> 3
  3

Tested as follows:

$ sphinx-build -b html -C -D extensions=sphinx.ext.doctest . out/
$ lynx -dump out/contents.html 
   #[1]Index [2]Search

>>> 1
1

>>> 3
3

...

It is missing:

  >>> 2
  2

in the output.

@tk0miya
Copy link
Member

tk0miya commented Feb 17, 2019

Thank you for example. confirmed. Surely, this is not intentional.

tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 27, 2019
tk0miya added a commit to tk0miya/sphinx that referenced this issue Feb 28, 2019
tk0miya added a commit that referenced this issue Feb 28, 2019
Fix #6068: doctest: ``skipif`` option may remove the code block from documentation
@tk0miya
Copy link
Member

tk0miya commented Feb 28, 2019

Fixed by #6115.
Thank you for reporting!

@tk0miya tk0miya closed this as completed Feb 28, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants