[Chandler-dev] Running functional tests with -O
Mikeal Rogers
mikeal at osafoundation.org
Tue Jul 3 23:29:48 PDT 2007
>> I think we should change the verification to something other than
>> asserts, then.
>
> +1
>
>> Maybe something like (I'd have to look at the actual code
>> that currently does the verifications to know for sure...):
>>
>> if Globals.options.recordedTest:
>> if test_condition_1 is False: raise AssertionError("test1
>> failed")
>> if test_condition_2 is False: raise AssertionError("test2
>> failed")
>> ...
>
> I'm more a fan of "if not blah" than "if blah is False". Or, wrap
> everything in a function à la unittest.
Currently we're using assert because they were quick and easy and the
easiest to debug.
If we change them to some other method that calls an assert we lose
simple debugging because the debugger post mortem will drop into
where the assert gets called, which is some far away test lib and not
where the actual failure happened.
I could add support for pdb debugging in to the framework, so that on
an assertion error it would grab the traceback and removed the last
call in the stack and then hand it off to the pdb.post_mortem(), but
this doesn't help John or anyone who is using a debugger that isn't pdb.
I know we need to move away from assert, but I can't see an
alternative that is as easy for everyone to debug as the current
method. I'm open to suggestions.
-Mikeal
More information about the chandler-dev
mailing list