gpt4 book ai didi

pytest -k 标志和语句

转载 作者:行者123 更新时间:2023-12-04 16:45:26 28 4
gpt4 key购买 nike

根据 pytest 文档,我应该能够像这样使用“and”表达式:

pytest -k stringexpr # only run tests with names that match the
# "string expression", e.g. "MyClass and not method"
# will select TestMyClass.test_something
# but not TestMyClass.test_method_simple

我试过的是这个表达式:

pytest -v test_file.py -k “TestTest and not test_bad”

我得到的错误是:

ERROR: file not found: and

我尝试过的其他变体以同样的失败告终:

pytest -v -k “TestTest and not test_bad”
pytest -v -k “TestTest and not test_bad” test_file.py

最后我的pytest版本是:3.0.3

最佳答案

您的 是一些奇怪的打印引号,而不是用于防止终端参数拆分的 " ascii 引号,这意味着您的pytest 实际上有四个参数:“TestTestandnottest_bad”

当我改用 " 时,您的示例对我来说效果很好。

关于pytest -k 标志和语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44415157/

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