[TIP] unittest issues and development

Michael Foord fuzzyman at voidspace.org.uk
Wed Feb 10 15:32:58 PST 2010


On 10/02/2010 23:22, Fernando Perez wrote:
> On Wed, Feb 10, 2010 at 5:29 AM, Michael Foord
> <fuzzyman at voidspace.org.uk>  wrote:
>    
>> Thanks. I've assigned it to me. When I get a chance to look at it properly I
>> will open up a discussion about it.
>>      
> Greatly appreciated.
>
> BTW, do you have any plans/interest in providing in unittest pep-8
> compatible names,
Unfortunately there are a lot of names and we just got rid of a lot of 
duplicates. It was discussed previously, but the conclusion was that we 
couldn't introduce a new set of duplicate names (effectively doubling 
what is already a fairly large API).

> as well as top-level names for the various
> assertions?  Nose.tools does that in a very simple but useful manner
> that makes lightweight (non-class-based) tests really nice to write:
>
> def test_foo():
>    nose.tools.assert_equals(bar, baz, 'nice message)
>    

I've never seen the advantage of this over self.assertEquals (ignoring 
the PEP 8 issue...). :-)

All the best,

Michael
> The amount of code for this in nose.tools is tiny enough that I think
> it would be nice to have it out of the box (and with proper pep8
> names) in the stdlib.  With a trivial decorator like the ones I showed
> you, these functions can even be seen by unittest as proper tests
> without any of the nose discovery machinery.
>
> Something like this would bring more of the light, friendly style of
> nose testing into the realm of the stdlib, with (IMO) minimal overhead
> of code.
>
> The easier it is to write tests, the higher the chances I'll have of
> convincing students to write them :)
>
> Cheers,
>
> f
>    


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.





More information about the testing-in-python mailing list