1 ,例如: pytest -vv -s run_test.py -------输出超详细测试结果, 并显示 print()或日志信息
2, 还有一些用例需要跳过的 ,有5种处理方法:
1) 用例中设置跳过

2) 条件跳过

3 , 运行时跳过

4, 预期失败

5, 命令行控制跳过
-k "pattern" → 只运行匹配的用例,其他相当于跳过
pytest -v test_linalg.py -k "TestLinalgCUDA and not `sed -z 's/\n/ and not /g' skip_tests/test_linalg_skip.txt`" --junitxml=./___test_linalg.xml
-m "not slow" → 通过标记选择用例
@pytest.mark.slow
def test_big_model():
pass
pytest -m "not slow" # 跳过标记了 slow 的用例
2443

被折叠的 条评论
为什么被折叠?



