简体   繁体   English

如何指定使用pytest k参数运行的唯一测试?

[英]How do you specify the only test to run with pytest k parameter?

I've tried the following: 我尝试了以下方法:

python -m pytest ./subfolder -k 'test_common_fields' python -m pytest ./subfolder -k'test_common_fields'

This doesn't work at all. 这根本不起作用。 It finds nothing but this test exists in that subfolder's file of the same name 'subfolder/test_subfolder.py' 它什么也没找到,但该测试存在于同名子文件夹“ subfolder / test_subfolder.py”的文件中

I tried entering full path: -k 'subfolder/test_subfolder.py::test_common_fields' and without "subfolder" path. 我尝试输入完整路径:-k'subfolder / test_subfolder.py :: test_common_fields'并且没有“ subfolder”路径。 Nothing. 没有。

在Ubuntu上,我通常使用py.test --verbose -k testcase_1 test_xyz.py

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

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