Improve locator and reporter test coverage#392
Conversation
Performance Report (macOS)
Legend
|
Performance Report (Linux) ➖
Legend
|
Test Coverage Report (Linux)
Coverage increased! Great work! |
Performance Report (Windows) ✅
Legend
|
Test Coverage Report (Windows)
Coverage increased! Great work! |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Adds focused unit coverage for previously under-tested locator, reporter, and JSONRPC paths, plus a few small robustness fixes discovered while writing tests.
Fixes #389