.coveragerc file when py.test starts

I am trying to run pytest to work with a coveragerc file. The settings in my .coveragerc file are not used, so I think the file is not used at all.

See my project structure and pytest calls below! What am I doing wrong?

Project:

basepath/lib/
basepath/.coveragerc
basepath/test/test_lib
basepath/test/run.py

I call test / run.py from virtualenv

basepath$ python test/run.py

run.py

import pytest
pytest.main('test/test_lib -v --cov-report xml --cov lib --cov-config .coveragerc')

I tried moving .coveragerc to different directories, i.e. lib /, test /, test / test_lib /, but none of them worked.

I expected to get a coverage file named "xxxcoverage" as set in .coveragerc, but I always got the default .coverage

.coveragerc

[run]
data_file = xxxcoverage
+5
source share
1 answer

pytest ... "":
:

, , . ( ) (data_file ).

, , data_file .coveragerc .

omit !

.coveragerc , ( )

+3

All Articles