Repository navigation
test: executed coverage for tools/import_bluefin_rawhide.py — new tests/test_import_bluefin_rawhide.py (resolve_source, main) - #107
Merged
Conversation
tools/import_bluefin_rawhide.py had no test file and 0% executed coverage
(60/60 statements missed). The shared grammar it consumes
(tools/rawhide_sources.py) is fully covered by tests/test_rawhide_sources.py,
but the tool's own two functions were never executed by the suite.
Adds tests/test_import_bluefin_rawhide.py with 15 unittest cases covering:
resolve_source()
- derives the source name from a sourcerpm and passes the expected
dnf repoquery argv
- de-duplicates and takes the first sorted candidate
- treats the "(none)" marker as no candidate
- reports stderr as the reason when repoquery returns nothing
- turns an unparseable candidate into an explicit reason, not a traceback
main()
- happy path: report contents, imported_sources ordering, and the
tools/import_rawhide.py argv
- creates the report parent directory
- [unavailable] packages policy excludes binaries before any query
- an absent policy file leaves every binary in scope
- unresolved binaries land in "unavailable" with their reason
- total resolution failure aborts before importing anything
- an existing destination short-circuits the import
- a failed import is recorded, not counted as imported, and falls back
to stdout when stderr is empty
- two binaries sharing one source are imported once
Every test stubs the module-level command() wrapper, so no dnf or fedpkg
process is spawned. Coverage for the module goes 0% -> 97% (only the
subprocess wrapper body and the __main__ guard remain), and tools/ overall
goes 54% -> 58%.
Test-only change: no production file is modified. Green under both CI
runners, python3 -m pytest tests -q (validate.yml) and
python3 -m unittest discover -s tests (rebuild-rpms.yml).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>
Contributor
Author
|
Deferring this PR's red checks: the cause is a repository-wide pin, not this diff. This branch adds Every Nothing in a test-only diff can resolve an unpublished base digest, so this PR — hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.78 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Improvement
Adds
tests/test_import_bluefin_rawhide.py— 15 unittest cases coveringtools/import_bluefin_rawhide.py, which had no test file and 0% executed coverage (60/60 statements missed).Exact ground this PR claims
tests/test_import_bluefin_rawhide.pytools/import_bluefin_rawhide.py— functionsresolve_source()andmain()What is covered
resolve_source()sourcerpmand passes the expecteddnf repoqueryargv(none)marker as "no candidate"stderras the reason when repoquery returns nothing usablemain()imported_sourcesordering, and thetools/import_rawhide.pyargv[unavailable] packagespolicy excludes binaries before any query is issuedunavailablewith their reasonstdoutwhenstderris emptyEvery test stubs the module-level
command()wrapper, so nodnforfedpkgprocess is ever spawned and the tests need no network.Measured result
The two remaining uncovered lines are the
subprocess.runwrapper body and the__main__guard.Both CI runners are green with the new file:
python3 -m pytest tests -q(validate.yml) — 196 passedpython3 -m unittest discover -s tests(rebuild-rpms.yml) — 196 tests, OKMutation-checked: inverting the
destination.exists()short circuit and neutering the[unavailable]policy filter each fail exactly one targeted test.Disjointness from open PRs
No other open PR touches
tools/import_bluefin_rawhide.pyortests/test_import_bluefin_rawhide.py:.github/workflows/import-rawhide-package.ymlonlytools/validate.py,tests/test_validate.py, two.hummingbird-upstream.jsontools/dist_bump.py,tests/test_dist_bump.py,docs/targeting-hummingbird.mddocs/architecture.md,tests/test_architecture_counts.pytools/source_pipeline.py,tools/validate.py,tools/package_inventory.py,tools/buildroot_lock.py,tools/factory_manifest.pyand their testsRelated Issue
Closes #106
Filed by quality agent (hold-gated mode). Human review required. Do not merge without review; the
holdlabel stays on.— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.78