简体   繁体   English

有没有办法在 pytest 中获取某个测试使用的所有设备名称?

[英]Is there a way to get all fixtures names used by some test in pytest?

Sometimes it's hard to understand why some fixture code is executed, while it seems should not.有时很难理解为什么会执行一些夹具代码,而似乎不应该。 So I'd like to print all fixtures names, which will be resolved for some concrete test by pytest for more detailed analysis, is there such feature in pytest?所以我想打印所有fixtures名称,这些名称将被pytest解析为一些具体测试以进行更详细的分析,pytest中有这样的功能吗?

is there such feature in pytest? pytest 中有这样的功能吗?

yes.是的。

I'd like to print all fixtures names, which will be resolved for some concrete test by pytest我想打印所有装置名称,这将通过 pytest 进行一些具体测试来解决

you could have a look at the output of these first:你可以先看看这些的输出:

pytest --fixtures          # show fixtures
pytest --fixtures -v       # show fixtures also with leading _
pytest --fixtures-per-test # show fixtures per test

if it was not enough, you might also check these out:如果这还不够,你也可以看看这些:

pytest --setup-only
pytest --setup-plan

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM