On VMs, use Salt's onedir to combine code coverage

And newer Python versions where we don't want to download the onedir

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2023-09-20 17:24:04 +01:00 committed by Pedro Algarvio
parent 7f2d7c342f
commit d53eff39fd
4 changed files with 25 additions and 3 deletions

View file

@ -20,7 +20,7 @@ on:
required: false
type: string
description: The python version to run tests with
default: "3.9"
default: "3.11"
salt-version:
type: string
required: true

View file

@ -43,7 +43,7 @@ on:
required: false
type: string
description: The python version to run tests with
default: "3.10"
default: "3.11"
package-name:
required: false
type: string

View file

@ -1327,6 +1327,28 @@ def combine_coverage(session):
pass
@nox.session(
python=str(ONEDIR_PYTHON_PATH),
name="combine-coverage-onedir",
venv_params=["--system-site-packages"],
)
def combine_coverage_onedir(session):
_install_coverage_requirement(session)
env = {
# The full path to the .coverage data file. Makes sure we always write
# them to the same directory
"COVERAGE_FILE": str(COVERAGE_FILE),
}
# Always combine and generate the XML coverage report
try:
session.run("coverage", "combine", env=env)
except CommandFailed:
# Sometimes some of the coverage files are corrupt which would trigger a CommandFailed
# exception
pass
@nox.session(python="3", name="create-html-coverage-report")
def create_html_coverage_report(session):
_install_coverage_requirement(session)

View file

@ -1432,7 +1432,7 @@ class VM:
"""
Combine the code coverage databases
"""
return self.run_nox("combine-coverage", session_args=[self.name])
return self.run_nox("combine-coverage-onedir", session_args=[self.name])
def create_xml_coverage_reports(self):
"""