[TIP] Unittest Changes

Michael Foord fuzzyman at voidspace.org.uk
Mon Jul 21 05:29:29 PDT 2008


tarjei wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>   
>> Any other good ideas about ways that unittest could change that don't 
>> either grow the API greatly or break backwards compatibility?
>>     
>
> Take a look at twisted's trial. They got two things I miss in unittest:
> - - the ability to only run a subset of tests based on path
> trial module.tests
> vs
> trial module.tests.test_module.TestSomeClass.testMethod
>   
We use something similar at work. It is very useful to be able to run a 
single test so I will add that to my list of changes.

> - - assertIsInstance(var, Class)  is also a very useful addition.
>
>   

There is some resistance to widening the API of unittest (which already 
has a myriad of 'assert*' methods) with new ones that can be written in 
only a line or two.

It probably means that my beloved assertIn, assertNotIn won't getIn - 
but such is life. I'll add it to the list, I think the changes will need 
a PEP anyway and we'll see what gets through.

Michael

> kind regards,
> Tarjei
>
>   
>> Michael Foord
>>
>>     
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFIhFUwYVRKCnSvzfIRAvG9AKC+lOfo+PIkl7k0pCyK3kyYNDbnbwCghXgY
> I+88JQk5ZWtJ6nbwD6Wc/x0=
> =XK+p
> -----END PGP SIGNATURE-----
>   


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/
http://www.trypython.org/
http://www.ironpython.info/
http://www.resolverhacks.net/
http://www.theotherdelia.co.uk/




More information about the testing-in-python mailing list