DRMacIver/hypothesis — pull request #9 by gmazzola (2014-09-08 22:52:01+00:00)
Title: Moved Verifier object creation inside wrapped_test. This fixes a bug whe...

The library has a function defined as follows:

def time_to_call_it_a_day(self):
return time.time() > self.start_time + self.timeout

If `time_to_call_it_a_day` returns True, the `falsifier` loop exits. The problem is, the Verifier object (and its `self.start_time` attribute) is created when `@given` is decorating the inner function.

The following is an example bug trigger. Let's say you have two unittests using hypothesis, meaning that there are two Verifier objects with roughly the same start_time value. The first Verifier object times out successfully via the `time_to_call_it_a_day` function, eating up time that the second Verifier could use to execute.

Since both Verifiers have the same `start_time` and timeout values, by the time the second Verifier runs, it has already timed out. Bug.