Allow to ignore the output in doctest

Luca Cerone avatarLuca Cerone created an issue

Hi everybody, I am relatively new to Sphinx, so I'd like to take the chance to thank all the developers and contributors for their work and effort.

I don't know how technically difficult this is, but I think it would be nice to have the option to test a command while completely ignoring the output.

While doctest has an ELLIPSIS directive for this, it allows to ignore portion of the output. Unfortunately ... denotes both line continuation and ellipsis, and prevents Sphinx to understand some text like:

.. doctest::

          >>> print "whatever you like" # doctest: +ELLIPSIS
          ...

I think it would be useful to test that a command is correctly executed regardless of its output (e.g. in the code I am documenting, one of the commands prints the name of some temporary files, and the output can be different when tested on different computers).

The only workaround I found is to add a SKIP directive, but I think some way to ignore al the output in a doctest might be useful.

Comments (0)

  1. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.