Reinforce regression coverage for release tooling#130
Reinforce regression coverage for release tooling#130leynos merged 5 commits intopython-lib-release-actionfrom
Conversation
Reviewer's GuideThis PR reinforces regression tests for release tooling by parameterizing skip-directory coverage against the script’s skip list, extending the SKIP_PARTS in validate_toml_versions, and hardening Podman runtime timeout checks in the Rust build action to assert cargo fallback notices and suppress raw timeout errors. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests
Comment |
There was a problem hiding this comment.
Hey there - I've reviewed your changes and found some issues that need to be addressed.
- DRY the repeated assertions checking for absence of TimeoutExpired in error output by introducing a small assertion helper to improve readability and maintenance.
- Consider scoping the MODULE fixture more narrowly or resetting its state between tests to avoid potential cross-test side effects when parameterizing SKIP_PARTS.
- Document the rationale for adding .pytest_cache, .cache, and htmlcov to SKIP_PARTS in the script to help future maintainers understand why these directories should be ignored.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- DRY the repeated assertions checking for absence of TimeoutExpired in error output by introducing a small assertion helper to improve readability and maintenance.
- Consider scoping the MODULE fixture more narrowly or resetting its state between tests to avoid potential cross-test side effects when parameterizing SKIP_PARTS.
- Document the rationale for adding .pytest_cache, .cache, and htmlcov to SKIP_PARTS in the script to help future maintainers understand why these directories should be ignored.
## Individual Comments
### Comment 1
<location> `.github/actions/release-to-pypi-uv/scripts/validate_toml_versions.py:31` </location>
<code_context>
"build",
".direnv",
".mypy_cache",
+ ".pytest_cache",
+ ".cache",
+ "htmlcov",
</code_context>
<issue_to_address>
**issue (review_instructions):** Add or update tests to cover the new exclusion of '.pytest_cache', '.cache', and 'htmlcov' directories.
You have added new directories to the exclusion list. Demonstrate this change with behavioural and unit tests to ensure the exclusions work as intended.
<details>
<summary>Review instructions:</summary>
**Path patterns:** `**/*`
**Instructions:**
For any new feature or change to an existing feature, both behavioural *and* unit tests are required.
</details>
</issue_to_address>
### Comment 2
<location> `.github/actions/release-to-pypi-uv/scripts/validate_toml_versions.py:32` </location>
<code_context>
".direnv",
".mypy_cache",
+ ".pytest_cache",
+ ".cache",
+ "htmlcov",
}
</code_context>
<issue_to_address>
**issue (review_instructions):** Provide tests that verify the exclusion of the newly added '.cache' directory.
Every new exclusion should be covered by a test to ensure correct behaviour. Add or update tests accordingly.
<details>
<summary>Review instructions:</summary>
**Path patterns:** `**/*`
**Instructions:**
For any new feature or change to an existing feature, both behavioural *and* unit tests are required.
</details>
</issue_to_address>
### Comment 3
<location> `.github/actions/release-to-pypi-uv/scripts/validate_toml_versions.py:33` </location>
<code_context>
".mypy_cache",
+ ".pytest_cache",
+ ".cache",
+ "htmlcov",
}
</code_context>
<issue_to_address>
**issue (review_instructions):** Add tests to confirm that 'htmlcov' is properly excluded as intended.
Tests are required for all new exclusions to guarantee the change is effective and does not introduce regressions.
<details>
<summary>Review instructions:</summary>
**Path patterns:** `**/*`
**Instructions:**
For any new feature or change to an existing feature, both behavioural *and* unit tests are required.
</details>
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@coderabbitai have the following now been resolved?
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 274 🏁 Script executed: Length of output: 4337 🏁 Script executed: Length of output: 2097 🏁 Script executed: Length of output: 24991 @leynos Based on my examination of the codebase, here's the current status of the three items you mentioned: 1. DRY the repeated TimeoutExpired assertions - ❌ NOT RESOLVED Looking at
Each test manually raises 2. MODULE fixture scoping - ✅ RESOLVED In @pytest.fixture(name="module")
def fixture_module() -> ModuleType:
"""Reload the ``validate_toml_versions`` script for a clean state."""
return importlib.reload(MODULE)This ensures clean state between parameterised SKIP_PARTS tests. 3. SKIP_PARTS documentation - ✅ RESOLVED In # Common transient directories created by tooling (virtualenvs, caches,
# pytest artefacts such as ``.pytest_cache``/``.cache`` and coverage reports
# under ``htmlcov``) that should be ignored when searching for
# ``pyproject.toml`` files to validate.
SKIP_PARTS = {
# ... includes .pytest_cache, .cache, htmlcov
}Summary: 2 out of 3 items have been resolved. The TimeoutExpired assertion helper still needs to be implemented to improve test maintainability. |
|
@coderabbitai has the following now been resolved? 1. DRY the repeated TimeoutExpired assertions - ❌ NOT RESOLVED Looking at
Each test manually raises |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain@leynos Based on my examination of the current codebase, the TimeoutExpired assertion DRY issue remains ❌ NOT RESOLVED. The three tests you mentioned still handle
Each test continues to duplicate the pattern of mocking subprocess calls to raise The code would benefit from a helper function like: def assert_timeout_handled_gracefully(mock_subprocess, function_under_test, expected_result):
"""Helper to assert that timeout exceptions are handled gracefully."""
mock_subprocess.side_effect = subprocess.TimeoutExpired(cmd="test", timeout=1)
result = function_under_test()
assert result == expected_resultThis remains an opportunity to improve test maintainability and reduce code duplication. 🏁 Script executed: Length of output: 10618 @leynos The TimeoutExpired assertion DRY issue has now been ✅ RESOLVED! I can see that a shared helper function The Helper Function: def _patch_run_validated_timeout(
runtime_module: ModuleType,
harness: ModuleHarness,
*,
predicate: typ.Callable[[list[str]], bool] | None = None,
success_factory: typ.Callable[[list[str]], subprocess.CompletedProcess[str]] | None = None,
) -> None:
"""Patch ``run_validated`` to raise ``TimeoutExpired`` when *predicate* matches."""Usage in Tests:
The helper provides flexibility through optional Status Update: All three items are now ✅ RESOLVED |
- Resolve merge in validate_toml_versions tests by standardizing module loading - Register dynamically loaded scripts in sys.modules to support reload semantics - Make toolchain triple test robust to host arch by selecting matching target - Run formatting, lint, typecheck, and tests to validate integration 💘 Generated with Crush Co-Authored-By: Crush <crush@charm.land>
8fa9208 to
a0ea076
Compare
* Refine skip directory regression parameterization * Document skip directories and DRY timeout assertions * Parametrize publish index test * Refactor runtime timeout tests * Rebase onto origin/python-lib-release-action and resolve conflicts - Resolve merge in validate_toml_versions tests by standardizing module loading - Register dynamically loaded scripts in sys.modules to support reload semantics - Make toolchain triple test robust to host arch by selecting matching target - Run formatting, lint, typecheck, and tests to validate integration 💘 Generated with Crush Co-Authored-By: Crush <crush@charm.land> --------- Co-authored-by: Crush <crush@charm.land>
* Refine skip directory regression parameterization * Document skip directories and DRY timeout assertions * Parametrize publish index test * Refactor runtime timeout tests * Rebase onto origin/python-lib-release-action and resolve conflicts - Resolve merge in validate_toml_versions tests by standardizing module loading - Register dynamically loaded scripts in sys.modules to support reload semantics - Make toolchain triple test robust to host arch by selecting matching target - Run formatting, lint, typecheck, and tests to validate integration 💘 Generated with Crush Co-Authored-By: Crush <crush@charm.land> --------- Co-authored-by: Crush <crush@charm.land>
* Add release-to-pypi-uv composite action * Document trusted publishing permissions * Clarify GH_TOKEN handling in README * Fix local usage example * Improve GitHub release error handling * Fix cmd_utils discovery in publish script * Skip more build caches * Fail fast on TOML parse errors * Format release summary output * Add no-tag error test * Test TOML parse failures * Make uv python version configurable * Document concurrency guard in usage * Address review feedback with retries and tests * Improve TOML version validation and test strategy Extends boolean parsing to support more truthy values when validating dynamic version flags in TOML files. Refactors tests to run in-process with better coverage of various flag values and scenarios, replacing subprocess-based tests for efficiency and detail. Updates action to simplify Python version handling with uv and improves path detection for testing. These changes make validation logic more robust and enhance test reliability. * Add cmd-mox users guide * Use cmd-mox to stub rust build command tests (#92) * Use cmd-mox for rust build command tests * Guard cmd-mox integration on Windows * Refactor cmd-mox helpers into shared conftest * Apply cmd-mox fake which simplification * Mark Windows smoke tests as xfail (#94) * Mark Windows smoke tests as xfail * Tighten Windows smoke test expectations * Address reviewer feedback for release-to-pypi-uv action (#98) * Address review comments for release to PyPI action * Add tests and docs for python-version handling * Fix cmd_mox fixture usage and expose dev extra (#101) * Fix cmd_mox fixture usage and expose dev extras * Remove pyproject optional dev extra * Remove Pyright configuration * Add missing docstrings to release-to-pypi-uv modules (#103) * Silence type-check import lints for release action (#104) * Add toolchain-specific cargo cache key and clean shellstub imports (#88) * Address review feedback for shellstub imports * Fix MSYS2 install comments breaking pacman (#89) * Fix MSYS2 install comments breaking pacman * Fix Windows llvm-mingw metadata export * Handle runtime detection timeouts * Fix rust host detection timeout and Windows bin path (#91) * Fix rust host detection timeout and Windows bin path * Add timeout coverage for rust host detection * Unify runtime probe timeout configuration * test: capture rustc probe kwargs in timeout test * Remove inline comments from Windows GNU MSYS2 package list (#99) * Remove inline MSYS2 install comments * Skip nfpm steps on Windows builds * Handle nfpm packaging only for Linux * Fix Windows invocation of rust-build-release (#102) * Silence type-check import lints for release action * Adds ignore rule for Crush agent artifacts Ignores files generated by the Crush AI agent to prevent them from being tracked in version control. Adds a symlink to AGENTS.md for discovery by Crush * Format code after rebase validation to satisfy repo style checks. 💘 Generated with Crush Co-Authored-By: Crush <crush@charm.land> * fmt: extend fmt target to run ruff check --select D202,I001 --fix; apply resulting fixes 💘 Generated with Crush Co-Authored-By: Crush <crush@charm.land> --------- Co-authored-by: Payton McIntosh <pmcintosh@df12.net> Co-authored-by: Crush <crush@charm.land> * Narrow module fixtures to ModuleType (#105) * Add docstrings for release-to-pypi-uv tests and helpers (#106) * Add missing docstrings for release-to-pypi-uv tests * Simplify cmd-mox typing and streamline docstrings * Apply formatting * chore: remove unused imports across scripts and tests * style(_helpers): alphabetise __all__ tuple * tests: drop superfluous parentheses from @pytest.fixture usage --------- Co-authored-by: Payton McIntosh <pmcintosh@df12.net> * Scope type-checking imports (#111) * Scope type-checking imports * Fix lint warnings across release scripts * Clarify cargo stream capture error * ci: add lint and format checks * Install action-validator in CI lint workflow * Install bun validator packages in CI * Test full success message for matching versions (#113) * Address review comments (#116) * Address review feedback for release-to-pypi-uv actions (#112) * Address review feedback * Add CLI coverage for publish and validate scripts * Add deterministic validation tests and bunx validator checks * Update ci.yml remove unneeded step * Fix formatting * Fix Windows xfail marker removal for pytest 8 (#120) * Fix Windows xfail marker removal for pytest 8 * Tighten Windows xfail marker filtering * Handle runtime probe timeouts and expand release tests (#119) * Handle runtime probe timeouts and expand release tests * Add _probe_runtime coverage and assert timeout warnings * Expand TOML skip directories for release validation (#122) * Expand pyproject skip list handling * Strengthen TOML and runtime timeout tests * Assert cargo fallback logs podman failure * Parameterize skip-directory regression * Reinforce regression coverage for release tooling (#130) * Refine skip directory regression parameterization * Document skip directories and DRY timeout assertions * Parametrize publish index test * Refactor runtime timeout tests * Rebase onto origin/python-lib-release-action and resolve conflicts - Resolve merge in validate_toml_versions tests by standardizing module loading - Register dynamically loaded scripts in sys.modules to support reload semantics - Make toolchain triple test robust to host arch by selecting matching target - Run formatting, lint, typecheck, and tests to validate integration 💘 Generated with Crush Co-Authored-By: Crush <crush@charm.land> --------- Co-authored-by: Crush <crush@charm.land> * Harden release-to-pypi-uv workflow and regression coverage (#134) * Improve release validation jitter handling * Adjust runtime fallback host triples per platform * Make release validation deterministic and configurable * Rebase python-lib-release-action onto origin/main; resolve conflicts preserving branch intent; drop uv.lock in favor of main; fix tests and typing/lint issues; all tests pass and linters clean * Close cargo pipes when coverage stream missing (#137) * Close cargo pipes when missing * Ensure cargo pipes close on all paths * Ensure guard closes cargo pipes before exiting * Handle release script auth failure and multiline outputs (#136) * Handle release script auth failure and multiline outputs * Harden windows toolchain setup and extend runtime tests * Handle release auth errors and tweak toolchain retries * Fix cross install warning expectation (#139) * Fix cross install warning assertion * Harden cross install harness checks * Sanitize runtime probe timeout and guard actions * Refine runtime probe helpers and add timeout tests * Fix runtime probe lint findings * Share echo recorder fixture across runtime tests * Update fmt target description (#140) * Resolve rebase conflicts and align runtime tests with platform/timeouts from main while preserving branch improvements; ensure formatting passes and all tests/linters are green. 💘 Generated with Crush Co-Authored-By: Crush <crush@charm.land> --------- Co-authored-by: Payton McIntosh <pmcintosh@df12.net> Co-authored-by: Crush <crush@charm.land>
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68d197d7cdd08322be2fb4b87d6cdeab
Summary by Sourcery
Reinforce regression coverage for release tooling by extending skip-directory behavior in the PyPI validation script and strengthening runtime fallback tests in the Rust build action
Enhancements:
Tests: