尽管指定maxfail=1
,假设似乎继续生成示例并运行它们并且在很晚之后失败。
有解决方法吗?
这是一个小例子:
from hypothesis.stateful import invariant, rule, RuleBasedStateMachine
class MaxFail(RuleBasedStateMachine):
count = 0
@rule()
def process(self):
self.count += 1
@invariant()
def all_done(self):
print('-- in invariant %d' % self.count)
if self.count > 1:
assert False
MaxFailTest = MaxFail.TestCase