Skip to content

Fix(coverage): Use package name in coverage source list#285

Open
ModeSevenIndustrialSolutions wants to merge 1 commit into
lfit:mainfrom
modeseven-lfit:fix/coverage-source-package-name
Open

Fix(coverage): Use package name in coverage source list#285
ModeSevenIndustrialSolutions wants to merge 1 commit into
lfit:mainfrom
modeseven-lfit:fix/coverage-source-package-name

Conversation

@ModeSevenIndustrialSolutions
Copy link
Copy Markdown
Contributor

@ModeSevenIndustrialSolutions ModeSevenIndustrialSolutions commented May 11, 2026

Summary

Single-file, single-line fix to pyproject.toml correcting a
latent coverage configuration bug.

[tool.coverage.run] source = ["src"] is a filesystem path.
coverage.py treats entries containing a path separator (or
matching a directory on disk) as path filters. Under
lfreleng-actions/python-test-action
v1.1.x — which installs the package non-editably into
.venv/lib/pythonX.Y/site-packages/ — that filter never matches
the installed location, so coverage reports 0% with a
No data was collected warning.

The fix is to use the import name (dependamerge) instead.
coverage.py instruments the package wherever it is imported from,
regardless of install location.

Why this is preventive

The bug is currently masked because addopts includes
--cov=dependamerge, which overrides the path-based source
list at the CLI. Removing the latent failure mode means the
project remains correctly measured if addopts changes or if
the action's flag handling evolves.

[tool.coverage.paths] is left in place: it does not affect
measurement, but does help when combining coverage data files
from multiple environments during reporting.

Related fixes

The same root cause has been addressed in sibling projects:

Change

 [tool.coverage.run]
-source = ["src"]
+source = ["dependamerge"]

Note

This PR previously also carried the "repo-scoped merge output
reporting" fixes; those have been consolidated into #277 so the
two changes can be reviewed together as a single coherent merge-
path improvement. This PR is now scoped to the trivial
single-file coverage fix.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a latent coverage configuration issue in pyproject.toml by switching Coverage.py’s [tool.coverage.run].source from a filesystem path filter ("src") to the importable package name ("dependamerge"), ensuring coverage collection works even with non-editable installs (e.g., in CI).

Changes:

  • Update [tool.coverage.run] source from ["src"] to ["dependamerge"] to make coverage instrumentation resilient to install location.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions Bot added the bug Something isn't working label May 11, 2026
@ModeSevenIndustrialSolutions ModeSevenIndustrialSolutions force-pushed the fix/coverage-source-package-name branch from 9e7c540 to c45f031 Compare May 11, 2026 13:13
Copilot AI review requested due to automatic review settings May 11, 2026 13:13
@ModeSevenIndustrialSolutions ModeSevenIndustrialSolutions force-pushed the fix/coverage-source-package-name branch from c45f031 to 5e52739 Compare May 11, 2026 13:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@ModeSevenIndustrialSolutions ModeSevenIndustrialSolutions force-pushed the fix/coverage-source-package-name branch from 5e52739 to bd065dd Compare May 11, 2026 14:39
Copilot AI review requested due to automatic review settings May 11, 2026 15:14
@ModeSevenIndustrialSolutions ModeSevenIndustrialSolutions changed the title Fix(coverage): Use package name in coverage source list Fix: Coverage source name and repo-scoped merge output reporting May 11, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread pyproject.toml
Comment thread src/dependamerge/cli.py Outdated
source = ['src'] is a filesystem path; coverage.py treats
entries containing a path separator as path filters. Under
lfreleng-actions/python-test-action v1.1.x, which installs the
package non-editably into .venv/lib/pythonX.Y/site-packages,
that filter never matches the installed location and coverage
reports 0% with a 'No data was collected' warning.

Use the import name 'dependamerge' instead. coverage.py
instruments the package wherever it is imported from.

This is currently masked because addopts includes
'--cov=dependamerge', which overrides the path-based source
list. The fix removes the latent failure mode so the project
remains correctly measured if addopts is changed or the
action's flag handling evolves.

[tool.coverage.paths] is left in place: it does not affect
measurement (this bug) but does help when combining coverage
data files from multiple environments during reporting.

Co-authored-by: Claude <claude@anthropic.com>
Signed-off-by: Matthew Watkins <mwatkins@linuxfoundation.org>
@ModeSevenIndustrialSolutions ModeSevenIndustrialSolutions force-pushed the fix/coverage-source-package-name branch from 61be861 to 3b477bb Compare May 13, 2026 12:54
Copilot AI review requested due to automatic review settings May 19, 2026 11:23
@ModeSevenIndustrialSolutions ModeSevenIndustrialSolutions force-pushed the fix/coverage-source-package-name branch from 3b477bb to 636b08b Compare May 19, 2026 11:23
@ModeSevenIndustrialSolutions ModeSevenIndustrialSolutions changed the title Fix: Coverage source name and repo-scoped merge output reporting Fix(coverage): Use package name in coverage source list May 19, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread pyproject.toml
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants