Skip to content

Improve locator and reporter test coverage#392

Draft
karthiknadig wants to merge 5 commits intomainfrom
feature/issue-389
Draft

Improve locator and reporter test coverage#392
karthiknadig wants to merge 5 commits intomainfrom
feature/issue-389

Conversation

@karthiknadig
Copy link
Copy Markdown
Member

Adds focused unit coverage for previously under-tested locator, reporter, and JSONRPC paths, plus a few small robustness fixes discovered while writing tests.

  • Add tests for pet-jsonrpc, pet-reporter, pet-pixi, pet-virtualenvwrapper, pet-global-virtualenvs, pet-env-var-path, pet-windows-store, and pet-windows-registry
  • Cover environment-key fallback behavior in pet-core and pet-reporter
  • Improve WORKON_HOME handling for symlinked/junction-backed virtualenvwrapper paths
  • Tighten WindowsApps filtering and Windows Store path checks

Fixes #389

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

Performance Report (macOS)

Metric PR (P50) PR (P95) Baseline (P50) Delta
Server Startup 67ms 535ms 52ms 15ms
Full Refresh 108ms 28359ms 100ms 8ms

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

Performance Report (Linux) ➖

Metric PR (P50) PR (P95) Baseline (P50) Delta Change
Server Startup 1ms 1ms 1ms 0ms 0%
Full Refresh 80ms 307ms 74ms 6ms 0%

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

Test Coverage Report (Linux)

Metric Value
Current Coverage 72.0%
Base Branch Coverage 67.9%
Delta 4.1% ✅

Coverage increased! Great work!

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

Performance Report (Windows) ✅

Metric PR (P50) PR (P95) Baseline (P50) Delta Change
Server Startup 9ms 12ms 11ms -2ms -18.2%
Full Refresh 145ms 529ms 186ms -41ms -22%

Results based on 10 iterations. P50 = median, P95 = 95th percentile.


Legend
  • 🚀 Significant speedup (>100ms faster)
  • ✅ Faster than baseline
  • ➖ No significant change
  • 🔺 Slower than baseline (>100ms)
  • ⚠️ Significant slowdown (>500ms)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

Test Coverage Report (Windows)

Metric Value
Current Coverage 68.72%
Base Branch Coverage 64.21%
Delta 4.51% ✅

Coverage increased! Great work!

Copy link
Copy Markdown

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 increases deterministic unit test coverage across multiple PET locator/reporting crates and tightens a few edge-case behaviors found while writing those tests (Windows Store path filtering, virtualenvwrapper WORKON_HOME handling, and environment-key fallback logic). It aligns with the repo’s broader goal of raising workspace coverage in the low-risk, fixture-based way described in #389.

Changes:

  • Add focused unit tests for previously under-tested locators/reporters and JSON-RPC routing/parsing paths.
  • Adjust environment-key fallback behavior for Conda environments (platform-specific default interpreter path).
  • Improve Windows/virtualenvwrapper path handling (WindowsApps filtering, WORKON_HOME symlink/junction scenarios).
Show a summary per file
File Description
crates/pet-windows-store/src/lib.rs Make WindowsApps-in-Program-Files check non-panicking on short inputs; add locator + refresh-state sync tests.
crates/pet-windows-store/src/environment_locations.rs Add unit tests for WindowsApps search location derivation (Windows-only).
crates/pet-windows-store/src/env_variables.rs Add tests covering EnvVariables home reading behavior.
crates/pet-windows-registry/src/lib.rs Add sync-scope tests + negative try_from cases (virtualenv/conda prefix).
crates/pet-virtualenvwrapper/src/lib.rs Add unit tests for kind/category reporting, env var reading, and try_from identification.
crates/pet-virtualenvwrapper/src/environments.rs Add symlink-aware WORKON_HOME containment logic and tests for identification + .project handling.
crates/pet-virtualenvwrapper/src/environment_locations.rs Make WORKON_HOME handling more robust (avoid canonicalize dependency); expand default path fallbacks + tests.
crates/pet-virtualenvwrapper/src/env_variables.rs Add tests for reading HOME and WORKON_HOME.
crates/pet-reporter/src/stdio.rs Add tests for summary counting and kind-based filtering behavior.
crates/pet-reporter/src/environment.rs Update Conda environment-key fallback path (Windows vs non-Windows) + add unit tests.
crates/pet-reporter/src/collect.rs Add tests ensuring CollectReporter accumulates reported items and defaults empty.
crates/pet-reporter/src/cache.rs Add tests validating manager/env dedupe and telemetry forwarding.
crates/pet-pixi/src/lib.rs Add unit tests for Pixi marker detection and try_from prefix derivation.
crates/pet-jsonrpc/src/server.rs Add unit tests for Content-Length parsing and request/notification routing + unknown method handling.
crates/pet-global-virtualenvs/src/lib.rs Fix Linux “Envs” dir detection to be under user home; add unit tests for directory/path enumeration behavior.
crates/pet-env-var-path/src/lib.rs Refactor WindowsApps filtering + add unit tests for dedupe and filtering behavior.
crates/pet-core/src/python_environment.rs Align Conda environment-key fallback behavior with platform defaults + add unit tests.

Copilot's findings

  • Files reviewed: 17/17 changed files
  • Comments generated: 0

Copy link
Copy Markdown

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 raises unit test coverage across several previously under-tested crates in the Python Environment Tools (PET) workspace, while making a few small robustness fixes found during test authoring—primarily around Windows path handling, environment-key fallback behavior, and virtualenvwrapper WORKON_HOME edge cases.

Changes:

  • Added focused unit tests across multiple crates (e.g., pet-jsonrpc, pet-reporter, pet-windows-store, pet-windows-registry, pet-virtualenvwrapper, pet-pixi, pet-global-virtualenvs, pet-env-var-path).
  • Improved a few production paths for correctness/robustness (WindowsApps filtering, conda environment-key fallback on Windows, virtualenvwrapper WORKON_HOME symlink/junction support).
  • Expanded refresh-state sync scope coverage (Full / Workspace / GlobalFiltered behaviors) for Windows Store/Registry locators.
Show a summary per file
File Description
crates/pet-windows-store/src/lib.rs Hardens WindowsApps path check and adds locator/refresh-state sync tests.
crates/pet-windows-store/src/environment_locations.rs Adds Windows-only tests for Windows Store search location derivation.
crates/pet-windows-store/src/env_variables.rs Adds tests for EnvVariables home extraction.
crates/pet-windows-registry/src/lib.rs Adds broader locator/refresh-state tests and try_from rejection tests.
crates/pet-virtualenvwrapper/src/lib.rs Adds unit tests covering locator basics and identification behavior.
crates/pet-virtualenvwrapper/src/environments.rs Improves WORKON_HOME matching for symlinked/junction-backed paths and adds tests.
crates/pet-virtualenvwrapper/src/environment_locations.rs Improves default WORKON_HOME fallbacks and removes brittle canonicalize requirement; adds tests.
crates/pet-virtualenvwrapper/src/env_variables.rs Adds tests for EnvVariables home + WORKON_HOME reads.
crates/pet-reporter/src/stdio.rs Adds tests verifying summary counting and kind-filtering behavior.
crates/pet-reporter/src/environment.rs Fixes conda fallback key path on Windows and adds tests.
crates/pet-reporter/src/collect.rs Adds tests for CollectReporter accumulation + default empty state.
crates/pet-reporter/src/cache.rs Adds tests for cache dedupe behavior and telemetry forwarding.
crates/pet-pixi/src/lib.rs Adds unit tests for pixi marker detection and prefix derivation behavior.
crates/pet-jsonrpc/src/server.rs Adds error-handler injection for tests, avoids responding to unknown notifications, improves error id handling, and adds unit tests.
crates/pet-global-virtualenvs/src/lib.rs Fixes Linux “Envs” default to be under home and adds coverage for dir/path enumeration behaviors.
crates/pet-env-var-path/src/lib.rs Refactors WindowsApps filtering + dedupe behavior and adds tests.
crates/pet-core/src/python_environment.rs Aligns conda fallback key path on Windows and adds tests for environment-key behavior.

Copilot's findings

  • Files reviewed: 17/17 changed files
  • Comments generated: 0 new

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.

Coverage: ranked plan to move workspace coverage toward 90%

2 participants