hrw4u: Add code coverage support for tests#12957
Open
zwoop wants to merge 1 commit intoapache:masterfrom
Open
Conversation
Contributor
zwoop
commented
Mar 12, 2026
- Adds some new tests, for additional coverage (e.g. debug runs)
- Eliminates some dead code discovered when there's no way to get the coverage over such code.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the HRW4U toolchain’s Python test suite and coverage workflow by adding targeted unit tests (including a debug-mode pass), adding pytest-cov configuration/Makefile targets, and trimming unused helper code in several HRW4U modules.
Changes:
- Add new unit tests for
common.pyhelpers and forLSPPatternMatcherintables.py, plus a debug-mode regression run over the “examples” test group. - Add pytest-cov as a dev dependency and wire up
make coverage/make coverage-open, plus coverage configuration and ignore rules. - Remove unused/dead helper methods in several
src/modules to reduce maintenance surface.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/hrw4u/tests/utils.py | Adds optional debug passthrough to visitor construction for existing golden tests. |
| tools/hrw4u/tests/test_tables.py | New unit tests covering LSPPatternMatcher pattern classification. |
| tools/hrw4u/tests/test_debug_mode.py | New tests that re-run the examples group with debug=True for both forward and reverse visitors. |
| tools/hrw4u/tests/test_common.py | New in-process unit tests for hrw4u.common functions to improve coverage visibility. |
| tools/hrw4u/src/visitor_base.py | Removes unused centralized error/indent utilities; relies on remaining context managers and trap handling. |
| tools/hrw4u/src/validation.py | Removes unused validators/imports. |
| tools/hrw4u/src/symbols_base.py | Removes unused caches/helpers and tightens imports. |
| tools/hrw4u/src/interning.py | Removes unused intern_any utility. |
| tools/hrw4u/src/generators.py | Removes unused reverse-map generation helpers, leaving the consolidated reverse map generator. |
| tools/hrw4u/src/errors.py | Removes unused exception note helpers. |
| tools/hrw4u/src/debugging.py | Removes unused context-manager methods and import. |
| tools/hrw4u/src/common.py | Changes create_base_parser()’s input_file argument behavior (now defaults to None). |
| tools/hrw4u/pyproject.toml | Adds pytest-cov and configures coverage run/report settings. |
| tools/hrw4u/Makefile | Adds coverage targets and cleans coverage artifacts. |
| tools/hrw4u/.gitignore | Ignores coverage outputs (htmlcov/, .coverage). |
You can also share your feedback on Copilot code review. Take the survey.
e3b5571 to
254eb06
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
tools/hrw4u/tests/test_units.py:33
sys,os, andSuffixGroupare imported here but not referenced anywhere in this test module. Please remove unused imports to keep the test file clean and avoid failing any future linting checks.
from hrw4u.types import MapParams, VarType, SuffixGroup
import pytest
import sys
import os
You can also share your feedback on Copilot code review. Take the survey.
- Adds some new tests, for additional coverage (e.g. debug runs) - Eliminates some dead code discovered when there's no way to get the coverage over such code.
254eb06 to
6cbc6dc
Compare
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.