Python doctest: Skip entire block?

My solution has been to trim the the 3-character >>> and ... leaders where I want doctest to skip over them, making them 2-characters.

So

"""
>>> from packagename import module
>>> module.show_real_world_usage()
'Hello world!'
"""

has become

"""
>> from packagename import module
>> module.show_real_world_usage()
'Hello world!'
"""

Epydoc doesn't display this as nicely as it does doctests, but I can live with this. A skip-until-further-notice directive in doctest would be welcome though.


Wrap the example in a function and then skip the function call:

"""
>>> def example():
...    from packagename import module
...    module.show_real_world_usage()
...
>>> example() # doctest: +SKIP
'Hello world!'
"""

Tags:

Python

Doctest