[Python-Dev] unsupported doctest directives in Doc/library/ctypes.rst

Chris Jerdonek chris.jerdonek at gmail.com
Thu Sep 13 15:25:52 CEST 2012


In the process of studying the global state of our doctests, I noticed
that the doctests in Doc/library/ctypes.rst use the following doctest
directives:

# doctest: +LINUX
# doctest: +WINDOWS

However, I'm not able to find evidence that these directives are
implemented anywhere.  Thus I get an error like the following when
trying to parse the file using doctest:

"ValueError: line 55 of the doctest for ctypes.rst has an invalid
option: '+WINDOWS'"

The reST file says this towards the top:

"Note: The code samples in this tutorial use :mod:`doctest` to make sure that
they actually work.  Since some code samples behave differently under Linux,
Windows, or Mac OS X, they contain doctest directives in comments.""

The farthest back I was able to trace this paragraph was here from April 2006:

http://hg.python.org/cpython/rev/0e0e315b4202

in which the docs seem to have been added from reST sources outside
the repository (from ctypes 0.9.9.6 upstream -- see the parent
changeset).

I would like for our docs to be parseable by doctest without error.
Possible options seem to include at least (1) changing these
directives to normal code comments until we can support these
directives in a meaningful way, and (2) calling
doctest.register_optionflag() for these directives as no-ops as
appropriate to make the errors go away.

Does anyone have any thoughts on this?

Thanks,
--Chris


More information about the Python-Dev mailing list