[Python-Dev] Proposed unittest changes

Michael Foord fuzzyman at voidspace.org.uk
Tue Jul 15 01:45:18 CEST 2008


Raymond Hettinger wrote:
> From: "Ben Finney" <ben+python at benfinney.id.au>
>> Right, so I'm putting up a separate PEP just for the renaming. Should
>> be arriving on this list soon.
>
> I would like to work with you or someone else who is interested
> on an alternative PEP for a separate, simpler test module
> using the py.test syntax.  That is much simpler to learn and use.
> Instead of self.assertIsNot and whatnot, you write:
>   assert a is not b
> No need for tons of word-by-word spellings on things we already
> have syntax for.  Almost anyone who has used py.test can attest
> its syntax is much more natural, easy to learn, easy to both
> read and write, and is much lighter weight.  I think some variant
> of py.test could be done that is compatable with unittest
> and the did not have the "magic" present in earlier versions of py.test.

Ah, in my haste I skipped over your comment about "magic", my apologies. 
But in the absence of magic how do you propose to provide a meaningful 
error message from the failure of:

assert a == b

To wrap it in a function like "assert equals(a, b)" seems to gain little 
over unittest.

Michael

> I wrote a recipe (somewhat rough and incomplete) that shows how
> easily this could be done:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/572194
>
> Raymond
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk 
>


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



More information about the Python-Dev mailing list