Sybil 1.0.0 Released!

4 views
Skip to first unread message

Chris Withers

unread,
May 26, 2017, 3:34:04 AM5/26/17
to testing-...@lists.idyll.org, Python List, simpl...@googlegroups.com, Benji York, Jim Fulton
Hi All,

I'm pleased to announce the first release of Sybil, a library to help
you test the examples in your documents.

For example, given the following Sphinx source file:

Sample Documentation
====================

Let's put something in the Sybil document's namespace:

.. invisible-code-block: python

remember_me = b'see how namespaces work?'

Suppose we define a function, convoluted and pointless but shows
stuff nicely:

.. code-block:: python

import sys

def prefix_and_print(message):
print('prefix:', message.decode('ascii'))

Now we can use a doctest REPL to show it in action:

>>> prefix_and_print(remember_me)
prefix: see how namespaces work?

The namespace carries across from example to example, no matter
what parser:

>>> remember_me
b'see how namespaces work?'


All the examples can be tested when using pytest by putting the
following in a conftest.py in your Sphinx source directory:

from doctest import ELLIPSIS
from sybil import Sybil
from sybil.parsers.codeblock import CodeBlockParser
from sybil.parsers.doctest import DocTestParser, FIX_BYTE_UNICODE_REPR

pytest_collect_file = Sybil(
parsers=[
DocTestParser(optionflags=ELLIPSIS|FIX_BYTE_UNICODE_REPR),
CodeBlockParser(future_imports=['print_function']),
],
pattern='*.rst',
).pytest()

The package is on PyPI and a full list of all the links to docs, issue
trackers and the like can be found here:

https://github.com/cjw96/sybil

Any questions, please do ask on the Testing in Python list or on the
Simplistix open source mailing list...

cheers,

Chris

PS: The name comes from Fawlty Towers, as this package is heavily
inspired by Benji York's fantastic Manuel package, which also took it's
name from the series!

Chris Withers

unread,
May 26, 2017, 3:54:40 AM5/26/17
to Jonathan Barratt, testing-...@lists.idyll.org, simpl...@googlegroups.com


On 26/05/2017 08:46, Jonathan Barratt wrote:
>> On May 26, 2560 BE, at 2:41 PM, Chris Withers <ch...@withers.org> wrote:
>>
>> Hi All,
>>
>> I'm pleased to announce the first release of Sybil, a library to help you test the examples in your documents.
> ...
>> https://github.com/cjw96/sybil
>
> cjw*2*96 :)

Well that's embarrassing :'$

https://github.com/cjw296/sybil

My next package will be one for testing release notes...

Chris

Chris Withers

unread,
May 30, 2017, 5:50:56 AM5/30/17
to Skip Montanaro, Python List, simpl...@googlegroups.com, Jim Fulton, Benji York
On 27/05/2017 00:56, Skip Montanaro wrote:
>
> On Fri, May 26, 2017 at 2:34 AM, Chris Withers <ch...@simplistix.co.uk
> <mailto:ch...@simplistix.co.uk>> wrote:
>
> The package is on PyPI and a full list of all the links to docs,
> issue trackers and the like can be found here:
>
> https://github.com/cjw96/sybil
>
> Chris,
>
> The GitHub URL 404s for me.

Sorry, forgot to include the Python list:
Reply all
Reply to author
Forward
0 new messages