Skip to content

Improve test coverage and remove dead code#538

Merged
MatthewMckee4 merged 3 commits intomainfrom
improve-test-coverage
Mar 21, 2026
Merged

Improve test coverage and remove dead code#538
MatthewMckee4 merged 3 commits intomainfrom
improve-test-coverage

Conversation

@MatthewMckee4
Copy link
Member

Summary

  • Add 21 new tests covering previously uncovered code paths identified via just coverage
  • Remove dead code: unused report_invalid_path function, INVALID_PATH diagnostic type, and RequiresFixtures impl on DiscoveredTestFunction

New integration tests

  • Monkeypatch: dotted import path setattr/delattr, MockEnv.context() classmethod, delitem raising behavior
  • Tags: pytest custom marks with -t tag filtering, pytest.param with marks lists and skip reasons
  • Fixtures: async generator fixtures (basic, teardown, multiple yields, teardown errors), invalid karva fixture scope
  • Snapshots: Command.current_dir(), accept/reject/pending with no pending snapshots
  • Output: --output-format=concise with failures and discovery errors

New unit tests

  • format_cmd_output edge cases (no trailing newlines on stderr/both)
  • SnapshotFile::parse with inline_source/inline_line metadata

Test plan

  • just test — all 706 tests pass
  • uvx prek run -a — all checks pass

🤖 Generated with Claude Code

Add 21 new tests covering previously uncovered code paths across
karva_test_semantic, karva_snapshot, and the main karva crate.
Remove unused `report_invalid_path`, `INVALID_PATH` diagnostic type,
and `RequiresFixtures` impl on `DiscoveredTestFunction`.

New integration tests:
- Monkeypatch setattr/delattr with dotted import paths
- MockEnv.context() classmethod
- Monkeypatch delitem raising behavior
- Pytest custom marks with tag filtering
- pytest.param with marks lists and skip reasons
- Async generator fixtures (basic, teardown, multiple yields, errors)
- Command.current_dir() for snapshot commands
- Invalid karva fixture scope
- Concise output format with failures and discovery errors
- Snapshot accept/reject/pending with no pending snapshots

New unit tests:
- format_cmd_output with no trailing newlines on stderr/both
- SnapshotFile::parse with inline metadata fields
@MatthewMckee4 MatthewMckee4 added the testing Related to testing Karva label Mar 21, 2026
The coverage job was generating an HTML report and uploading it as a
GitHub artifact, but never uploading to Codecov. Add LCOV export to
the justfile coverage recipe and a codecov-action step to CI.
Codecov receives the LCOV data directly, making the HTML artifact
upload unnecessary.
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 21, 2026

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 1 untouched benchmark


Comparing improve-test-coverage (28cabea) with main (d03f25c)

Open in CodSpeed

@codecov
Copy link

codecov bot commented Mar 21, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...es/karva_test_semantic/src/discovery/discoverer.rs 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@MatthewMckee4 MatthewMckee4 merged commit 123b682 into main Mar 21, 2026
9 of 10 checks passed
@MatthewMckee4 MatthewMckee4 deleted the improve-test-coverage branch March 21, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Related to testing Karva

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant