Set environment variable that skips or tracks code coverage

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2022-10-04 07:36:14 +01:00 committed by Megan Wilhite
parent 37f2fa6d12
commit a4247b6a1d
2 changed files with 14 additions and 2 deletions

View file

@ -1047,8 +1047,7 @@ def _ci_test(session, transport):
runtests_log_filename = "runtests"
rerun_failures = os.environ.get("RERUN_FAILURES", "0") == "1"
track_code_coverage = os.environ.get("CI_TRACK_COVERAGE", "1") == "1"
track_code_coverage = os.environ.get("SKIP_CODE_COVERAGE", "0") == "0"
common_pytest_args = [
"--color=yes",

View file

@ -184,6 +184,14 @@ def rsync(ctx: Context, name: str):
"--print-tests-selection",
],
},
"skip_code_coverage": {
"help": "Skip tracking code coverage",
"action": "store_true",
"flags": [
"--scc",
"--skip-code-coverage",
],
},
}
)
def test(
@ -194,6 +202,7 @@ def test(
rerun_failures: bool = False,
skip_requirements_install: bool = False,
print_tests_selection: bool = False,
skip_code_coverage: bool = False,
):
"""
Run test in the VM.
@ -204,6 +213,10 @@ def test(
env["RERUN_FAILURES"] = "1"
if print_tests_selection:
env["PRINT_TEST_SELECTION"] = "1"
if skip_code_coverage:
env["SKIP_CODE_COVERAGE"] = "1"
else:
env["SKIP_CODE_COVERAGE"] = "0"
if (
skip_requirements_install
or os.environ.get("SKIP_REQUIREMENTS_INSTALL", "0") == "1"