我正在尝试如何使用pytest从测试文件中获取测试名称的列表我已经做到了:
$ pytest --collect-only my_test_file.py
============================================================================================= test session starts ==============================================================================================
platform darwin -- Python 3.6.4, pytest-3.2.5, py-1.5.2, pluggy-0.4.0
rootdir: /Users/.../automation, inifile:
plugins: xdist-1.20.1, metadata-1.7.0, html-1.17.0, forked-0.2, cloud-2.0.0
collected 6 items
<Module 'my_test_file.py'>
<UnitTestCase 'TestFile'>
<TestCaseFunction 'test_general'>
<TestCaseFunction 'test_search_0'>
<TestCaseFunction 'test_search_1'>
<TestCaseFunction 'test_search_2'>
<TestCaseFunction 'test_search_3'>
<TestCaseFunction 'test_search_4'>
虽然这是一个好的开始,但信息太多了。我应该传递什么来获取测试名称本身的列表?在
使用
quiet
更改集合输出。在您可以使用
^{2}$当使用两次(或更多)时,
quiet
将打印每个模块的测试数量:相关问题 更多 >
编程相关推荐