pythonmarkdowndoctestgithub-flavored-markdown

python: doctest my github-markdown files?


I'd like to run the doctests from this file, and it's not clear to me out to accomplish it:

README.md:

# WELCOME!

This library is helpful and will help you in _many_ ways!

For example:

```
>>> import library
>>> library.helps()
True
```

(aside: can anyone help me get this to highlight as markdown?)


Solution

  • As an alternative to doctest I wrote mkcodes, a script that pulls code blocks out of markdown files so they can be tested in a separate file.

    Here's my actual test script using mkcodes:

    mkcodes --github --output tests/docs/test_{name}.py docs
    py.test tests
    pyflakes tests
    pep8 tests