Skip to content

hrw4u: Add code coverage support for tests#12957

Open
zwoop wants to merge 1 commit intoapache:masterfrom
zwoop:Hrw4uCodeCoverage
Open

hrw4u: Add code coverage support for tests#12957
zwoop wants to merge 1 commit intoapache:masterfrom
zwoop:Hrw4uCodeCoverage

Conversation

@zwoop
Copy link
Contributor

@zwoop 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.

@zwoop zwoop added this to the 11.0.0 milestone Mar 12, 2026
@zwoop zwoop requested review from bneradt and Copilot March 12, 2026 06:24
@zwoop zwoop self-assigned this Mar 12, 2026
@zwoop zwoop added the hrw4u label Mar 12, 2026
Copy link
Contributor

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 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.py helpers and for LSPPatternMatcher in tables.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.

@zwoop zwoop force-pushed the Hrw4uCodeCoverage branch 2 times, most recently from e3b5571 to 254eb06 Compare March 12, 2026 15:45
@zwoop zwoop requested a review from Copilot March 12, 2026 16:57
Copy link
Contributor

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 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, and SuffixGroup are 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.
@zwoop zwoop force-pushed the Hrw4uCodeCoverage branch from 254eb06 to 6cbc6dc Compare March 12, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants