[Twisted-Python] Thoughts about testing

glyph at divmod.com glyph at divmod.com
Thu Oct 27 02:12:40 EDT 2005

On Thu, 27 Oct 2005 11:38:01 +1100, Jonathan Lange <jml at mumak.net> wrote:
>On 26/10/05, David Ripton <dripton at ripton.net> wrote:

>> 1. assert, not self.failUnlessAllThisUglyCamelCaseActuallyKillsMe()

>class FooTest(unittest.TestCase):
>    failureException = AssertionError
>    def test_foo(self):
>        assert False  #yay fails

My understanding is that if you do

    t = True
    nil = False
    assert t == nil

in py.test, the error reporting will show you "t != nil (True != False)" or somesuch, along with a bunch of other useful diagnostic information.

My proposal was to steal this by doing 'self.failUnless(t == nil)' and stealing as much of their stack introspection junk (available as a hacked version of AssertionError) as we can.

More information about the Twisted-Python mailing list