Skip to content

Add targeted check --junitxml test coverage for XML output and failure reporting#94

Draft
Copilot wants to merge 6 commits into
mainfrom
copilot/fix-code-review-suggestion
Draft

Add targeted check --junitxml test coverage for XML output and failure reporting#94
Copilot wants to merge 6 commits into
mainfrom
copilot/fix-code-review-suggestion

Conversation

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

The review feedback requested explicit coverage for the new --junitxml mode in the check CLI path. This update adds focused tests in tests/test_check.py to assert report generation and failure serialization for invalid rules.

  • Test coverage added

    • Added test_check_junitxml_created_and_well_formed to verify:
      • report file is created
      • XML parses successfully
      • root structure is valid (testsuite or testsuites)
    • Added test_check_junitxml_reports_failures_for_invalid_rules to verify invalid rules emit <failure> entries.
  • Branch-safe guard for option availability

    • Added a lightweight helper that skips these tests when check does not expose a junitxml parameter (keeps tests scoped to the reviewed feature without introducing unrelated failures in branches lacking the option).
def skip_if_junitxml_unavailable():
    if "junitxml" not in {param.name for param in check.params}:
        pytest.skip("--junitxml option is not available in this branch")

def test_check_junitxml_reports_failures_for_invalid_rules(tmp_path):
    runner = CliRunner()
    skip_if_junitxml_unavailable()
    report_path = tmp_path / "check-report.xml"
    result = runner.invoke(check, ["--junitxml", str(report_path), "tests/files/invalid"])
    root = ET.parse(report_path).getroot()
    assert result.exit_code == 1
    assert len(root.findall(".//failure")) > 0

Copilot AI changed the title [WIP] Fix code according to review comment Add targeted check --junitxml test coverage for XML output and failure reporting Jun 15, 2026
Copilot AI requested a review from thomaspatzke June 15, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants