pytest --collectonly 收集测试案例

pytest --collectonly 是一条命令行指令,用于在运行 pytest 测试时仅收集测试项而不执行它们。它会显示出所有可用的测试项列表,包括测试模块、测试类和测试函数,但不会执行任何实际的测试代码。

这个命令对于查看项目中的测试结构和确保所有的测试项都能被正确识别非常有用。通过检查收集到的测试项,你可以确保你的测试代码被正确组织,并且所有的测试都被识别出来。

请注意,pytest --collectonly 命令不会运行任何测试代码,它只是用来收集测试项的元数据信息。如果你想要执行实际的测试,可以使用 pytest 命令,或者添加其他选项和标志来指定运行的测试范围。

复制代码
import pytest

if __name__ == '__main__':
    # pytest.main(['-v', '--emoji', './case', '--html=./report/report.html', '--self-contained-html'])
    pytest.main(['-s',  '--collectonly', './case'])
相关推荐
鹿鸣悠悠1 天前
pytest + requests + allure 接口自动化测试框架指南
pytest
忘忧记1 天前
pytest进阶参数化用法
前端·python·pytest
bug_rabbit2 天前
pytest-html 中文乱码问题终极解决方案(Windows版)
windows·html·pytest
庄小法2 天前
pytest
开发语言·python·pytest
工具人55552 天前
pytest练习
pytest
好家伙VCC3 天前
# Pytest发散创新:从基础测试到智能断言的实战进阶指南在现代软
java·python·pytest
小罗和阿泽3 天前
GUI 自动化测试 pywinauto测试框架
开发语言·python·功能测试·测试工具·pytest
文人sec4 天前
抛弃 Postman!用 Pytest+Requests+Allure+Playwright+Minium 搭建高逼格接口+UI自动化测试平台
自动化测试·python·测试工具·ui·pytest·playwright
曲幽4 天前
FastAPI单元测试实战:别等上线被喷才后悔,TestClient用对了真香!
python·单元测试·pytest·api·fastapi·web·httpx·testclient·依赖项覆盖
小罗和阿泽4 天前
接口测试系列 接口自动化测试 pytest框架(四)
pytest