自定义最终部分中的pytest插件内容
我正在使用pytest-rerunfailures
插件来标记大型测试套件中的片状测试。我喜欢插件对输出格式进行的添加,因为测试执行:我可以看到每个测试的通过或失败时的状态,如果失败,我可以看到清晰标记的rerun
nater lack通过下一个测试的尝试。这使得随着片状测试失败,然后重新运行变得容易进行。
,pytest-rerunfailures
在最终的“简短测试摘要信息”部分中未显示任何RERUN
信息(除了最终摘要行(并未向您显示需要重新运行的测试> -ra 命令行选项,我在这里做过):
我想从测试运行末尾的第一部分中获取信息,所以我不知道必须滚动控制台中的页面和页面,以查看哪些测试是重新运行的。我一直在考虑在测试运行末尾创建一个自定义部分,基于我找到的答案在这里。使用该技巧,我可以打印出一个不错的自定义部分(即使以黄色为黄色,插件标记重新融合结果的颜色相同)。但是我似乎无法弄清楚如何提取我想要的信息:在哪些测试中进行了哪些测试以及哪些需要重新运行。
谁能伸出援手?预先感谢!
I'm using the pytest-rerunfailures
plugin to mark flaky tests in a large test suite. I like the addition the plugin makes to the output format as tests execute: I can see each test's status as it passes or fails, and if it fails, I can see the clearly-marked RERUN
designation, followed by the next attempt at that test. This makes it easy to follow along as flaky tests fail and then get rerun.
However, pytest-rerunfailures
does not show any RERUN
information in the final "short test summary info" section of the terminal output (except for the final summary line, which doesn't show you which tests needed to be rerun) - it only shows Pass/Fail/Skipped/Xfail/Xpass/Error/Warning results (true even if pytest is run with the -rA
command line option, wihch I did here):
I'd like to have the information from the first section available at the end of the test run so I don't have to scroll back pages and pages in the console to see which tests were rerun. I was looking at creating into a custom section at the end of the test run, based on the answer I found here. Using that tip, I'm able to print out a nice custom section (even in yellow, the same color the plugin marks RERUN outcomes). But I can't seem to figure out how to pull in the information I want: which tests were run when, and which of those required a rerun.
Can anyone lend a helping hand? Thank in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,如果您在运行时指定
-rar
选项,则确实会获取最终重播信息摘要
部分。但是它是黑白的,并且不是“流”的,也不是初始测试会话开始
部分。以与初始部分相同的方式介绍最终重新融资信息部分:颜色编码,并连续划定每个测试尝试,而不仅仅是一个测试需要重新运行的摘要。It turns out that if you specify the
-raR
option when you run, you do get afinal rerun info summary
section. It's black and white though, and doesn't "flow" as well as the initialtest session starts
section. It would be clearer to present the final rerun info section in the same way as the initial section is presented: color-coded, and delineating each test attempt in succession, not just a summary of which tests required a rerun.