[Chandler-dev] Running functional tests with -O
grant at osafoundation.org
Tue Jul 3 11:24:43 PDT 2007
On 3 Jul, 2007, at 11:14, Heikki Toivonen wrote:
> D John Anderson wrote:
>> The recorded scripts use asserts to do verification. This turns
>> out to
>> be very convenient for development, because of our debugging
>> environment. We could implement another assert mechanism that does
>> same thing assert does and is controlled by some other mechanism/
>> line flag besides -O. That didn't seem worth the effort since we
>> need to use asserts in the testing code and asserts are a well
>> established convention.
> I think we should change the verification to something other than
> asserts, then.
> 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.
>> If the reason you want to do the tests without -O is that you're
>> about the side-effects introduced by asserts, then implementing
>> equivalent assert mechanism to run tests won't avoid side-effects
>> of the
>> same testing code.
> Not just asserts, but if __debug__: sections introducing side-
> effects as
> well. Also, running with -O changes timing which we also know to be a
> thing that affects our tests.
> Heikki Toivonen
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> Open Source Applications Foundation "chandler-dev" mailing list
More information about the chandler-dev