pytest with --cov-append flag overwrites coverage file

Viewed 30

I have multiple projects within the same repo, that is:

  • src\python\projectA
  • src\python\projectB

Each project has its own python environment for running the test. During build, pytest is executed as follows:

root=${pwd}  
cd $root\src\python\projectA  
conda actiate envA  
python -m pytest --junitxml=$root\src\python\TestReport\projectA\junit.xml --cov=. --cov-append --cov-report=xml:$root\src\python\TestReport\coverage.xml --disable-warnings .\test  

cd $root\src\python\projectB  
conda actiate envB  
python -m pytest --junitxml=$root\src\python\TestReport\projectB\junit.xml --cov=. --cov-append --cov-report=xml:$root\src\python\TestReport\coverage.xml --disable-warnings .\test

The --cov-append flag is supposed to enable appending new test coverage to the file, but instead the file is overwritten and I get the results from projectB only since its tests are executed after those of projectA.

What am I missing?

Thanks!

0 Answers
Related