rackspace/python-proboscis — Issue #9: Idea: create an equivalent to BOOST_CHECK macros.
Author: TimSimpsonR
Created: 2012-02-28 22:41:22+00:00
State: open

If possible it'd be cool to be able to have multiple test assertions in a single function that still caused the function to fail but did not raise until the end of the method. This way if the test runs in Jenkins or otherwise takes awhile, you can see the results of other assertions to know if it finished or not. Like this:

from proboscis import Check:

def test():
result = some_expensive_call()
with Check() as check:
check.equal("GOOD", result.status)
check.equal(5, result.some_number)
check.not_equal(false, result.is_bad)
check.true(result.finished)

Any exceptions are simply recorded by check. If there is no block, it raises instantly.
When there is a block, it records the error and holds onto it until the end of the block, at which point it fills a single assertion message with each item and raises it.