Add a flag that saves the coverage output dir

This commit adds a pytest command line option `--no-cleanup` for
the coverage test. Running the coverage test with this option will
let users save the `kcov_output` directory so that it is easier to
inspect the coverage report.

Signed-off-by: Henry Wang <henry.wang@arm.com>
This commit is contained in:
Henry Wang
2020-02-24 13:37:09 +08:00
committed by Laura Loghin
parent 97025bdb9b
commit 02004b5bd1
2 changed files with 18 additions and 4 deletions
+12
View File
@@ -17,6 +17,13 @@ def pytest_addoption(parser):
PROFILE_DEVEL
)
)
parser.addoption(
"--no-cleanup",
action="store_true",
default=False,
help="Keep the coverage report in `kcov_output` directory. If this flag is not provided, "
"both coverage related directories are removed."
)
@pytest.fixture
@@ -24,6 +31,11 @@ def profile(request):
return request.config.getoption("--profile")
@pytest.fixture
def no_cleanup(request):
return request.config.getoption("--no-cleanup")
# This is used for defining global variables in pytest.
def pytest_configure():
pytest.profile_ci = PROFILE_CI