片状:假设检验产生不可靠的结果是什么意思? [英] What does Flaky: Hypothesis test produces unreliable results mean?

查看:58
本文介绍了片状:假设检验产生不可靠的结果是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用假设 python 包进行测试.

I am using the hypothesis python package for testing.

我收到以下错误:

片状:假设 test_visiting 产生不可靠的结果:在第一次调用时被证伪,但在随后的调用中没有

Flaky: Hypothesis test_visiting produces unreliable results: Falsified on the first call but did not on a subsequent one

据我所知,测试工作正常.

As far as I can tell, the test is working correctly.

我该如何解决这个问题?

How do I get around this?

推荐答案

这或多或少意味着它所说的:您有一个测试,第一次失败,但在使用相同的示例重新运行时第二次成功.这可能是一个假设错误,但通常不是.最常见的原因是您有一个依赖于某些外部状态的测试 - 例如如果您使用的是系统随机数生成器而不是提供的假设,或者如果您的测试创建了一些文件并且仅在测试开始时这些文件不存在时才会失败.第二个最常见的原因是您的失败是递归错误,而在一个函数调用级别触发它的示例在另一个级别没有触发.

It means more or less what it says: You have a test which failed the first time but succeeded the second time when rerun with the same example. This could be a Hypothesis bug, but it usually isn't. The most common cause of this is that you have a test which depends on some external state - e.g. if you're using a system random number generator rather than a Hypothesis provided one, or if your test creates some files and only fails if the files did not exist at the start of the test. The second most common cause of this is that your failure is a recursion error and the example which triggered it at one level of function calls did not at another.

您并未真正提供足够的信息来说明实际发生的情况,因此很难提供比这更具体的建议.如果您正在运行最新版本的 Hypothesis(例如 1.9.0 肯定会这样做),您应该得到有关正在发生的事情的非常详细的诊断 - 它会告诉您您遇到的原始异常是什么,并且它会报告传入的值似乎在调用之间发生了变化.

You haven't really provided enough information to say what's actually happening, so it's hard to provide more specific advice than that. If you're running a recent version of Hypothesis (e.g. 1.9.0 certainly does it) you should have been given quite detailed diagnostics about what is going on - it will tell you what the original exception you got was and it will report if the values passed in seemed to change between calls.

这篇关于片状:假设检验产生不可靠的结果是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆