gpt4 book ai didi

python - 有没有办法获取 pytest 中某些测试使用的所有固定装置名称?

转载 作者:行者123 更新时间:2023-12-03 08:20:02 25 4
gpt4 key购买 nike

有时很难理解为什么某些固定代码会被执行,而它似乎不应该被执行。所以我想打印所有的灯具名称,这些名称将由pytest解析以进行一些具体测试以进行更详细的分析,pytest中有这样的功能吗?

最佳答案

is there such feature in pytest?

是的。

I'd like to print all fixtures names, which will be resolved for some concrete test by pytest

你可以先看看这些的输出:

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

如果还不够,您还可以查看以下内容:

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

关于python - 有没有办法获取 pytest 中某些测试使用的所有固定装置名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68122898/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com