状态测试给出 hypothesis.errors.Flaky: 运行 最初失败但第二次尝试成功

Stateful testing gives hypothesis.errors.Flaky: Run failed initially but succeeded on a second try

我正在尝试使用与此处所做的类似的假设来解决难题:

http://nchammas.com/writing/how-not-to-die-hard-with-hypothesis

不幸的是,它间歇性地失败并出现 Flaky 错误,我无法使用 pdb 追踪问题。

我的节目源在:

https://gist.github.com/sureshvv/0fb78ef221fb8c1ed85dd034c83abefa

可以运行使用py.test。

感谢任何诊断和解决问题的帮助。

问题是由于在我的规则中调用 random.sample 引起的。需要使用 strategies.choices() 代替。