[TIP] Sclara is a Python testing DSL

Chris.Wesseling at cwi.nl Chris.Wesseling at cwi.nl
Mon Mar 26 00:56:15 PDT 2012

On 2012-03-24T16:00:06-0500, John MacKenzie wrote:
> http://github.com/198d/sclara
> There are failures in both as a demonstration of how this interacts with a
> TestRunner. The first one proves mainly that this is just Python; if you
> use one of the provided runners you can execute your test files with the
> Python interpreter (a big goal after looking at a tool like komira for this
> sort of thing). The latter demonstrates that a nose plugin is possible and
> probably implies that a py.test plugin is doable to.

Could you point me to "komira"? Your e-mail turns up as the only
relevant hit using my search-fu.

> Beyond sclara, I'm considering the idea that, more than a testing
> framework, I stumbled on an interesting pattern for building generic DSLs
> in Python (more on this soon, hopefully).
> Thoughts?

I started reading the tests, to see if the DSL provides the clarity we need in
this domain:

examples/test_sclara.py line 14:

    with test('does not have access to inner setup context') as context:
        except AttributeError:

Will this fail if no AttributeError is thrown?

And line 45:

    with test('has access to inner setup context') as context:
        assert context.foo == 'bar'
    with test('has access to outer setup context') as context:
        assert context.bar == 'foo'

Shouldn't "inner" and "outer" be swapped here?
The outer setup adds foo and baz attributes.
The inner setup adds the bar attribute to the context and changes the baz value.

What I see as a pitfall for users with this idiom, is that it might invite to
breaking isolation. 

Interesting, though.

Chris Wesseling
Centrum Wiskunde & Informatica (CWI)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20120326/b7e986a7/attachment.pgp>

More information about the testing-in-python mailing list