[Python-Dev] Proposed unittest changes
Michael Foord
fuzzyman at voidspace.org.uk
Tue Jul 15 01:43:12 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.
However, to provide readable output for errors in even simple tests
(like a == b) py.test does magic with stack frames and code objects - in
order to discover the objects being compared.
As this relies on what are essentially implementation details of the
Python interpreter it means that some implementations (specifically
IronPython which doesn't have Python stack frames and only a minimal
representation of frame objects) will never be able to run it.
I think it would be a bad idea to move *Python testing* itself over to a
framework like this.
I personally find unittest pretty readable, the feature most lacking is
autodiscovery of tests which nose does seem to provide very well
although I haven't used it yet.
Michael
> 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.
> 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