redding / assert

Assertion style testing framework.
https://github.com/redding/assert
MIT License
10 stars 1 forks source link

accumulate: set callbacks based on whether accumulating test data #279

Closed kellyredding closed 8 years ago

kellyredding commented 8 years ago

This is another minor optimization related to now accumulating test run data as opposed to storing test/result objects. The default view adds callbacks based on whether it is accumulating test data or not. This avoids some conditionals in the callbacks b/c we implicitly know we are accumulating test data or not.

Note: I chose to add these to the view's metaclass (or eigenclass) to avoid messing with the view's class definition. These callbacks are specific only to the view instance.

Note: I also chose to no longer override and super the initialize method and instead just set state in the on_start callback. There is no advantage to resetting run data on init and the conditional for setting callbacks can't be called until the on_start anyway b/c all of the state for the conditions isn't guaranteed until on_start.

@jcredding ready for review. This should be the last effort on this feature, btw.

jcredding commented 8 years ago

@kellyredding - "implicitly no" in commit message should be "implicitly know" I think

jcredding commented 8 years ago

@kellyredding - Looks good :boom: