Dear all, I am writing the documentation for a Python package using Sphinx.
I have a problem when using doctest blocks in the documentation: I couldn't manage to get doctest to run a command but completely ignoring the output. For example, how can I get a doctest like the following to run correctly? .. doctest:: example_1 >>> import random >>> x = random.uniform(0,100) >>> print str(x) #some directive here to completely ignore the output Since I don't know the value of `x`, ideally in this doctest I only want to test that the various commands are correct, regardless of the output produced. I have tried using the ELLIPSIS directive, but the problem is that the `...` are interpreted as line continuation rather than `any text`: .. doctest:: example_2 >>> import random >>> x = random.uniform(0,100) >>> print str(x) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE ... I don't know if there is a way to make Sphinx understand that I want to ignore the whole output. I think the easiest way to solve this, would be differentiating between the ellipsis sequence and the line continuation sequence, but I don't know how to do that. I know that I could skip the execution of print(str(x)) but this is not what I want; I really would like the command to be executed the output ignored. Can you point me to any solution for this issue? Thanks a lot in advance for your help, Cheers, Luca -- https://mail.python.org/mailman/listinfo/python-list