[docs] [issue15939] make *.rst files in Doc/ parseable by doctest

Ezio Melotti report at bugs.python.org
Thu Oct 11 19:56:27 CEST 2012

Ezio Melotti added the comment:

> A way to do it could be to register new doctest directives that skip
> the marked test based on the value of sys.platform.

That can be done for 3.4+ only though.

> If we remove the directives, we lose that information and won't
> be able to do it anymore.

It actually seems quite easy to distinguish them.  At the beginning 'libc' is created either using cdll.msvcrt (on windows) or CDLL("libc.so.6") (on Linux).  There are examples that use windll and other Windows- or Linux-specific functions later on but it's usually quite evident.  If we get lost we can always dig in the history or just run the tests and see where they fail.

FTR there were a few actual errors that I fixed (mostly about bytes vs string).  I also removed unnecessary prints and added a few doctest directives to make some of the tests pass.  'from ctypes import *' is used quite frequently, and it would be better to change it, but I left it unchanged for now.  I also removed an obsolete warning about the doctest directives in the example because Sphinx hides them.


Python tracker <report at bugs.python.org>

More information about the docs mailing list