问题描述
我的项目结构如下:
myproject
src
-routes.py
-services.py
-data_access.py
tests
-test_routes.py
-test_services.py
我想运行覆盖 src 的测试,但想排除 src/data_access.py。
我想实现类似于: pytest 测试 --cov=src --exclude=src/data_access.py 但 exclude 不是正确的参数。
解决方法
您可能需要添加coveragerc 并使用--omit 选项。