[TIP] Sybil 1.0.0 Released!

Chris Withers chris at withers.org
Tue May 30 10:41:16 PDT 2017


On 26/05/2017 09:02, Harry Percival wrote:
> I did quite a lot of testing for my book about testing. If you're
> looking for inspiration for future features, the code is at:
>
> https://github.com/hjwp/Book-TDD-Web-Dev-Python/tree/master/tests

Sounds like you could have used Manuel? And of course: Sybil, but my 
time machine is unfortunately faulty...

> I wanted to be able to:
>
> - parse listings and incomplete listings

Not sure what this means?

> - handle state including multiple files,

Sybil supports state across examples within a file, cross-file state is 
a little weird, no?

> including non-python code

Writing a parser/evaluator for this should be fairly trivial...

> - check that arbitrary terminal commands, if executed in the cumulative
> context of the listings so far, actually produce the output the book
> says they do (tests and their tracebacks mostly)

Heh, the example I use in Sybil's docs is a very basic version of this:

http://sybil.readthedocs.io/en/latest/parsers.html#developing-your-own-parsers

> I ended up with something that may be a little too specific to my use
> case, and a little overengineered, and spaghetti code full of the
> vestiges of abandoned dead end approached.  A brief attempt to roll my
> own textwrap.textwrap for example.

I'm quite happy with Sybil's code, it was artisanal* after all.

> But still, end results are there. And of course yes there are tests for
> the tests of the tests in the testing book.
>
> Happy to talk anyone through any of the code if it's of interest.

If you want to refactor it to use Sybil, I'd be happy to help if you hit 
problems :-)

> Otherwise please just pat me on the back and tell me how smart I am?  ;-)
> HP

Could I just buy you a pint instead?

cheers,

Chris

* https://twitter.com/chriswithers13/status/868008457525497856



More information about the testing-in-python mailing list