[TIP] RFF: Article on python test design pattern - DAI

Olemis Lang olemis at gmail.com
Tue Dec 8 07:13:44 PST 2009


On Tue, Dec 8, 2009 at 9:55 AM,  <exarkun at twistedmatrix.com> wrote:
> On 04:07 am, amax at redsymbol.net wrote:
>>
>> (that's Request For Feedback)
>>
>> Hi everyone,
>>
>> Here is a draft article about a useful design pattern for Python code
>> tests:
>>
>> http://redsymbol.net/articles/deep-assertion-injection/
>>
>> I am surely not the first to use this idiom, but I *might* be the first to
>> document it this well, and to give it a name.  Have you seen this before?
>> Constructive feedback is appreciated.
>>
>> Thanks in advance for your comments.  Either reply here on the list, or by
>> email to amax at redsymbol.net.
>
> Hi Aaron,
>
[...]
>
> This has the shortcoming that it's harder to use the failure to pinpoint the
> exact code which is wrong, though.  It'd be nice to have some tools to make
> it easy to combine the advantages of each of these approaches. For example,
> a non-exception based failure signaling mechanism,

Hmmmm ... if something failed in your (unit)tests then it should be an
exception condition (considering unittest philosophy and | or style
since you write «positive» test cases i.e. conditions that have be
asserted in to make the TC pass) . Isn't it ?

> or a stack capturing
> helper which allows for easy annotation of later assertions.
>

Little comment :

Modules that contain __unittest = True are hidden in failure
tracebacks . Is this what you 'r talking about ?

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:



More information about the testing-in-python mailing list