Skip to content

Improve test coverage and refactor visitor.rs#539

Merged
MatthewMckee4 merged 2 commits intomainfrom
improve-coverage-round-2
Mar 21, 2026
Merged

Improve test coverage and refactor visitor.rs#539
MatthewMckee4 merged 2 commits intomainfrom
improve-coverage-round-2

Conversation

@MatthewMckee4
Copy link
Member

Summary

  • Refactor try_process_imported_symbol in visitor.rs to use ? via resolve_imported_fixture(), replacing 15 let ... else { return } patterns
  • Extract is_generator() helper to deduplicate generator detection logic
  • Add 10 new integration tests covering previously untested CLI flags and feature combinations

Refactoring

  • try_process_imported_symbol now delegates to resolve_imported_fixture() -> Option<()> which uses ? for all fallible steps
  • is_generator() extracted as a standalone function, used by both process_fixture_function and resolve_imported_fixture

New tests

  • --fail-fast stops after first failure, works across modules
  • --dry-run with nested package structure
  • -s (show Python output) flag
  • --retry flag for flaky tests
  • --output-format=concise with test failures and discovery errors
  • --durations with skipped tests (verifies skipped tests appear in durations)
  • --last-failed with multiple files and after fixing a test
  • @expect_fail combined with @parametrize (both pytest and karva)

Test plan

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

🤖 Generated with Claude Code

Refactor `try_process_imported_symbol` in visitor.rs to use `?` via a
helper method returning `Option<()>`, replacing 15 `let ... else { return }`
patterns. Extract `is_generator()` helper to deduplicate generator detection.

Add integration tests covering:
- `--fail-fast` flag (stops after first failure)
- `--fail-fast` across multiple modules
- `--dry-run` with nested packages
- `-s` (show Python output)
- `--retry` flag for flaky tests
- `--output-format=concise` with failures and discovery errors
- `--durations` with skipped tests
- `--last-failed` with multiple files
- `--last-failed` after fixing a failing test
- `@expect_fail` combined with `@parametrize`
@MatthewMckee4 MatthewMckee4 added the testing Related to testing Karva label Mar 21, 2026
@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-coverage-round-2 (a1857e0) with main (123b682)

Open in CodSpeed

Use `tempfile.gettempdir()` instead of hardcoded `/tmp` which doesn't
exist on Windows.
@codecov
Copy link

codecov bot commented Mar 21, 2026

Codecov Report

❌ Patch coverage is 89.74359% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rates/karva_test_semantic/src/discovery/visitor.rs 89.74% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@MatthewMckee4 MatthewMckee4 merged commit bf7d2e9 into main Mar 21, 2026
11 checks passed
@MatthewMckee4 MatthewMckee4 deleted the improve-coverage-round-2 branch March 21, 2026 17:01
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