<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.hoenzb
        {mso-style-name:hoenzb;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Hmm – I am thinking that a python dsl similar to JS’s Jasmine with matchers would be doable.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">with describe(“foo”):<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> It(“should throw bar”):<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> expect( lambda : foo.doStuff()).toRaise(BarException);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">There definitely are many python test things other than doctest and unittest (Freshen, Lettuce, PySpec, spec plugin for nose, should-dsl for some). The trick
to acceptance is compatibility probably, make sure that there is a nose plugin, that it works with Micheal Foord’s mock, that doesn’t do such strange magic that it taints the global namespace and makes stuff behave incorrectly.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> testing-in-python-bounces@lists.idyll.org [mailto:testing-in-python-bounces@lists.idyll.org]
<b>On Behalf Of </b>Alfredo Deza<br>
<b>Sent:</b> 26 March 2012 12:08<br>
<b>To:</b> Chris.Wesseling@cwi.nl<br>
<b>Cc:</b> John MacKenzie; testing-in-python@lists.idyll.org<br>
<b>Subject:</b> Re: [TIP] Sclara is a Python testing DSL<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Mon, Mar 26, 2012 at 3:56 AM, <<a href="mailto:Chris.Wesseling@cwi.nl">Chris.Wesseling@cwi.nl</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal">On 2012-03-24T16:00:06-0500, John MacKenzie wrote:<br>
> <a href="http://github.com/198d/sclara" target="_blank">http://github.com/198d/sclara</a><br>
[...]<o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">> There are failures in both as a demonstration of how this interacts with a<br>
> TestRunner. The first one proves mainly that this is just Python; if you<br>
> use one of the provided runners you can execute your test files with the<br>
> Python interpreter (a big goal after looking at a tool like komira for this<br>
> sort of thing). The latter demonstrates that a nose plugin is possible and<br>
> probably implies that a py.test plugin is doable to.<o:p></o:p></p>
</div>
<p class="MsoNormal">Could you point me to "komira"? Your e-mail turns up as the only<br>
relevant hit using my search-fu.<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Konira is a Testing DSL framework [0] that I started working on about a year and a half ago. It<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">is not valid Python (hence the DSL connotation) but it is translated to it when tests are run<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">via de included Test Runner or with the py.test [1] plugin for it.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">The problem that I see these solutions (including Konira) bring to the table is that they all try to<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">create a flexible, descriptive and terse domain for writing tests, and while some of them have a <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">significant gain over current testing standards, they fail when the complexity goes beyond <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">asserting something that has a nice description.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">It might be heretic to raise this in a testing list for Python, but I also believe that the Python community<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">is not as pro-innovation in the testing environment as other communities are, which is detrimental to the fact<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">that there are a few people who don't like the standard testing framework and are looking forwards to an<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">alternative.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
> Beyond sclara, I'm considering the idea that, more than a testing<br>
> framework, I stumbled on an interesting pattern for building generic DSLs<br>
> in Python (more on this soon, hopefully).<br>
><br>
> Thoughts?<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">I started reading the tests, to see if the DSL provides the clarity we need in<br>
this domain:<br>
<br>
examples/test_sclara.py line 14:<br>
<br>
with test('does not have access to inner setup context') as context:<br>
try:<br>
context.bar<br>
except AttributeError:<br>
pass<br>
<br>
<br>
Will this fail if no AttributeError is thrown?<br>
<br>
And line 45:<br>
<br>
with test('has access to inner setup context') as context:<br>
assert context.foo == 'bar'<br>
<br>
with test('has access to outer setup context') as context:<br>
assert context.bar == 'foo'<br>
<br>
Shouldn't "inner" and "outer" be swapped here?<br>
The outer setup adds foo and baz attributes.<br>
The inner setup adds the bar attribute to the context and changes the baz value.<br>
<br>
<br>
What I see as a pitfall for users with this idiom, is that it might invite to<br>
breaking isolation.<br>
<br>
Interesting, though.<o:p></o:p></p>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">[0] <a href="http://konira.cafepais.com/docs/index.html">http://konira.cafepais.com/docs/index.html</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">[1] <a href="http://pypi.python.org/pypi/pytest-konira">http://pypi.python.org/pypi/pytest-konira</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal" style="margin-bottom:12.0pt"><span class="hoenzb"><span style="color:#888888">--</span></span><span style="color:#888888"><br>
<span class="hoenzb">Chris Wesseling</span><br>
<span class="hoenzb">Centrum Wiskunde & Informatica (CWI)</span><br>
<span class="hoenzb"><a href="https://www.cwi.nl/people/ccw" target="_blank">https://www.cwi.nl/people/ccw</a></span><br>
</span><br>
_______________________________________________<br>
testing-in-python mailing list<br>
<a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
<a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
**************************************************************************************<br>
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data
may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.<br>
<br>
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00<br>
**************************************************************************************<br>
</font>
</body>
</html>