<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:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">Hmm &#8211; I am thinking that a python dsl similar to JS&#8217;s Jasmine with matchers would be doable.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">with describe(&#8220;foo&#8221;):<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp; It(&#8220;should throw bar&#8221;):<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp; &nbsp;expect( lambda : foo.doStuff()).toRaise(BarException);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;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&#8217;s mock, that doesn&#8217;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:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> 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>&nbsp;</o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">On Mon, Mar 26, 2012 at 3:56 AM, &lt;<a href="mailto:Chris.Wesseling@cwi.nl">Chris.Wesseling@cwi.nl</a>&gt; wrote:<o:p></o:p></p>
<p class="MsoNormal">On 2012-03-24T16:00:06-0500, John MacKenzie wrote:<br>
&gt; <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">&gt; There are failures in both as a demonstration of how this interacts with a<br>
&gt; TestRunner. The first one proves mainly that this is just Python; if you<br>
&gt; use one of the provided runners you can execute your test files with the<br>
&gt; Python interpreter (a big goal after looking at a tool like komira for this<br>
&gt; sort of thing). The latter demonstrates that a nose plugin is possible and<br>
&gt; probably implies that a py.test plugin is doable to.<o:p></o:p></p>
</div>
<p class="MsoNormal">Could you point me to &quot;komira&quot;? 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>&nbsp;</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>&nbsp;</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&nbsp;<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">significant gain over current testing standards, they&nbsp;fail when the complexity goes beyond&nbsp;<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>&nbsp;</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>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</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>
&gt; Beyond sclara, I'm considering the idea that, more than a testing<br>
&gt; framework, I stumbled on an interesting pattern for building generic DSLs<br>
&gt; in Python (more on this soon, hopefully).<br>
&gt;<br>
&gt; 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>
&nbsp; &nbsp;with test('does not have access to inner setup context') as context:<br>
&nbsp; &nbsp; &nbsp; &nbsp;try:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;context.bar<br>
&nbsp; &nbsp; &nbsp; &nbsp;except AttributeError:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pass<br>
<br>
<br>
Will this fail if no AttributeError is thrown?<br>
<br>
And line 45:<br>
<br>
&nbsp; &nbsp;with test('has access to inner setup context') as context:<br>
&nbsp; &nbsp; &nbsp; &nbsp;assert context.foo == 'bar'<br>
<br>
&nbsp; &nbsp;with test('has access to outer setup context') as context:<br>
&nbsp; &nbsp; &nbsp; &nbsp;assert context.bar == 'foo'<br>
<br>
Shouldn't &quot;inner&quot; and &quot;outer&quot; 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>&nbsp;</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]&nbsp;<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">&nbsp;<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 &amp; 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>&nbsp;</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>