mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Properly report code on coverage on linux from a windows coverage database
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
5d34517a6b
commit
e718cce3d0
2 changed files with 17 additions and 13 deletions
16
.coveragerc
16
.coveragerc
|
@ -32,20 +32,12 @@ ignore_errors = True
|
|||
[paths]
|
||||
salt =
|
||||
salt/
|
||||
/tmp/testing/salt/
|
||||
/tmp/kitchen/testing/salt/
|
||||
/private/tmp/kitchen/testing/salt/
|
||||
C:\Windows\Temp\testing\salt
|
||||
C:\Users\admini~1\AppData\Local\Temp\kitchen\testing\salt\
|
||||
C:\Users\Administrator\AppData\Local\Temp\kitchen\testing\salt\
|
||||
**/testing/salt/
|
||||
**\testing\salt
|
||||
tests =
|
||||
tests/
|
||||
/tmp/testing/tests/
|
||||
/tmp/kitchen/testing/tests/
|
||||
/private/tmp/kitchen/testing/tests/
|
||||
C:\Windows\Temp\testing\tests
|
||||
C:\Users\admini~1\AppData\Local\Temp\kitchen\testing\tests\
|
||||
C:\Users\Administrator\AppData\Local\Temp\kitchen\testing\tests\
|
||||
**/testing/tests/
|
||||
**\testing\tests
|
||||
extension_modules =
|
||||
tests/integration/files/extension_modules/
|
||||
*/extension_modules/
|
||||
|
|
14
noxfile.py
14
noxfile.py
|
@ -6,11 +6,11 @@ Nox configuration script
|
|||
"""
|
||||
# pylint: disable=resource-leakage,3rd-party-module-not-gated
|
||||
|
||||
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sqlite3
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
|
@ -456,6 +456,18 @@ def _report_coverage(session):
|
|||
# exception
|
||||
pass
|
||||
|
||||
if not IS_WINDOWS:
|
||||
# The coverage file might have come from a windows machine, fix paths
|
||||
with sqlite3.connect(COVERAGE_FILE) as db:
|
||||
res = db.execute(r"SELECT * FROM file WHERE path LIKE '%salt\%'")
|
||||
if res.fetchone():
|
||||
session_warn(
|
||||
session,
|
||||
"Replacing backwards slashes with forward slashes on file "
|
||||
"paths in the coverage database",
|
||||
)
|
||||
db.execute(r"UPDATE OR IGNORE file SET path=replace(path, '\', '/');")
|
||||
|
||||
if report_section == "salt":
|
||||
json_coverage_file = (
|
||||
COVERAGE_OUTPUT_DIR.relative_to(REPO_ROOT) / "coverage-salt.json"
|
||||
|
|
Loading…
Add table
Reference in a new issue