gue*_*tli 31 python unit-testing pytest
我找不到列出我可以调用的测试的方法 py.test -k PATTERN
如何查看可用测试列表?
flu*_*lub 56
您也可以使用--collect-only,这将显示收集节点的树状结构.通常可以简单地-k在Function节点的名称上.
You should use the flag --collect-only. If you are using pytest 5.3.0 or newer use --co.
pytest --co
Run Code Online (Sandbox Code Playgroud)
pytest --collect-only
Run Code Online (Sandbox Code Playgroud)
You can use this flag among other flags, so in your case pytest --co -k PATTERN.
小智 5
无论--collect只和--setup计划将打印出测试文件和单独的测试。
--collect-only(或--co)以 <[ type ] [ name ]> 格式打印
pytest --collect-only
# or
pytest --co
# <Module test_file.py>
# <Function test__my_awesome_code_does_the_awesome_thing>
Run Code Online (Sandbox Code Playgroud)
--setup-plan更详细并打印整个测试运行计划(包括用于每个测试的任何设置、拆卸和夹具)。它还打印每个测试的整个路径。
pytest --setup-plan
# tests/test_file.py
# SETUP [...]
# tests/test_file.py::test__my_awesome_code_does_the_awesome_thing (fixtures used: [...])
# TEARDOWN [...]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7853 次 |
| 最近记录: |