[Twisted-Python] Thoughts about testing
jml at mumak.net
Wed Oct 26 20:38:01 EDT 2005
On 26/10/05, David Ripton <dripton at ripton.net> wrote:
> 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()
failureException = AssertionError
assert False #yay fails
> 2. You can use module-level test functions. No need to make a test
> class unless it's actually helpful. (Yay Java.)
This feature is present in unittest, and presumably works for free in
Trial. Don't know about cmd line support.
> 3. Tests execute in predictable order.
Trial *ought* to execute tests in a predictable order. If it doesn't,
please file a bug on http://www.twistedmatrix.com/bugs/, assign it to
'jml' with topic 'trial'. (Also, please include repro)
> 4. setup_module / setup_class / setup_method. Handy for reusing
> database connections.
We are working on something better than that.
> 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).
Thanks for the feedback!
More information about the Twisted-Python