[Twisted-Python] Thoughts about testing
dripton at ripton.net
Wed Oct 26 07:56:49 EDT 2005
On 2005.10.25 12:59:24 -0400, Jean-Paul Calderone wrote:
> Rather than hearing about the plethora of new testing libraries
> appearing, I'd like to hear about features they provide that are
> valuable for writing tests. I would certainly like to borrow
> py.test's magical assert. What other features are test authors
> finding useful in some of these projects?
Things I particularly like about py.test, vs. unittest:
1. assert, not self.failUnlessAllThisUglyCamelCaseActuallyKillsMe()
2. You can use module-level test functions. No need to make a test
class unless it's actually helpful. (Yay Java.)
3. Tests execute in predictable order.
4. setup_module / setup_class / setup_method. Handy for reusing
5. A separate test runner binary, so you don't need __main__ boilerplate
in every test module, and you can put tests in the same module as a
script (if you don't care about them being found automatically).
6. You can fill your tests with print statements, and only see their
output if the test fails (or you pass the -s option).
David Ripton dripton at ripton.net
More information about the Twisted-Python