Skip to content

Commit

Permalink
Fix build path used to correct python coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
jdorn-gt committed Jul 22, 2024
1 parent c67903d commit 5a5ab6a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions .ci/adjust-coverage-paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,19 @@

if args.source_dir is None:
parser.error("either --source-dir or CI_PROJECT_DIR is required")
args.source_dir = args.source_dir.resolve()

if args.build_dir is None:
args.build_dir = args.coverage.parent.resolve()
args.build_dir = args.coverage.parent
args.build_dir = args.build_dir.resolve()

et = ElementTree.parse(args.coverage)
for source in et.iter("source"):
if source.text:
relpath = Path(source.text).relative_to(args.build_dir)
source.text = str(Path(args.source_dir, relpath))
fixed = str(Path(args.source_dir, relpath))
print("mapping", source.text, "to", fixed)
source.text = fixed

if args.output:
et.write(args.output)
Expand Down
2 changes: 1 addition & 1 deletion .ci/gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ report-coverage-py:
- pip install coverage
- cd build/python
- coverage xml
- ../../.ci/adjust-coverage-paths.py --in-place coverage.xml
- ../../.ci/adjust-coverage-paths.py --in-place coverage.xml --build-dir ..
- coverage report


Expand Down

0 comments on commit 5a5ab6a

Please sign in to comment.