<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 3/26/2012 8:28 AM, Staple, Danny (BSKYB) wrote:
<blockquote
cite="mid:DAC86F5F3B84F14088F0DB16092558CA17EF87E972@UKMA1.UK.NDS.COM"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<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]-->
<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>
</div>
</blockquote>
I've never seen the value in ladling English all over my test
cases. How is your code better than what you can currently do with
unittest?:<br>
<br>
def test_should_throw_bar(self):<br>
"""foo should throw bar"""<br>
with self.assertRaises(BarException):<br>
foo.doStuff()<br>
<br>
Not to mention, the snippet you presented isn't valid Python, yet
involves a lambda...<br>
<br>
--Ned.<br>
<br>
<blockquote
cite="mid:DAC86F5F3B84F14088F0DB16092558CA17EF87E972@UKMA1.UK.NDS.COM"
type="cite">
<div class="WordSection1">
<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
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
lang="EN-US">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif""
lang="EN-US"> <a class="moz-txt-link-abbreviated" href="mailto:testing-in-python-bounces@lists.idyll.org">testing-in-python-bounces@lists.idyll.org</a>
[<a class="moz-txt-link-freetext" href="mailto:testing-in-python-bounces@lists.idyll.org">mailto:testing-in-python-bounces@lists.idyll.org</a>]
<b>On Behalf Of </b>Alfredo Deza<br>
<b>Sent:</b> 26 March 2012 12:08<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:Chris.Wesseling@cwi.nl">Chris.Wesseling@cwi.nl</a><br>
<b>Cc:</b> John MacKenzie; <a class="moz-txt-link-abbreviated" href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><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
moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
<a moz-do-not-send="true"
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 color="Gray" face="Arial" 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 <a class="moz-txt-link-abbreviated" href="mailto:postmaster@nds.com">postmaster@nds.com</a> 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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
testing-in-python mailing list
<a class="moz-txt-link-abbreviated" href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a>
<a class="moz-txt-link-freetext" href="http://lists.idyll.org/listinfo/testing-in-python">http://lists.idyll.org/listinfo/testing-in-python</a>
</pre>
</blockquote>
</body>
</html>