7

In the project that I am currently working on, I have few of my colleagues who have written unit tests using unittest package and some using pytest package. When I run unit tests in CI pipeline, I invoke all of the unit tests. But, we now also need to get overall code coverage package. So, I have updated unit test invocation script by adding coverage (Please see script snippet below). But, I see that when I run below script I get coverage output of coverage run -a -m pytest -v -m unittests (line 7 below) only not the tests run before. But, if I remove the line coverage run -a -m pytest -v -m unittests (line 7 below), I get output of previous unit tests.

#!/bin/bash
set -xe
coverage run -m unittest test_a.py
coverage run -a -m unittest test_b.py
coverage run -a -m unittest test_c.py
...
cd process/tests/
coverage run -a -m pytest -v -m unittests
coverage report -m --omit=*/venv/*

coverage only reports the output of coverage run -a -m pytest -v -m unittests ignoring the previously run unit tests.

Can I please know how can I get a single report for all unit tests in above scenario?

1 Answer 1

2

Used combine command to fix the problem:

https://coverage.readthedocs.io/en/latest/cmd.html#cmd-combine

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.