Restore EnvLock synchronisation unit tests (#321)#363
Conversation
PR #273 removed the `#[cfg(test)]` block in `tests/bdd/fixtures/mod.rs` that validated `ensure_env_lock()` and the `Drop`-based working directory restoration, leaving these synchronisation properties untested at the unit level. Restore the four tests (first-call acquisition, idempotency, CWD capture, and Drop restoration), adapted to the current semantics. The two CWD-asserting tests now hold an outer re-entrant `EnvLock` for their full duration so parallel test threads cannot move the process CWD between the world's drop and the assertion.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Reviewer's GuideRestores and strengthens unit tests around EnvLock behavior in the BDD fixtures module, covering lock acquisition, idempotency, and CWD capture/restore semantics while making them robust against interference from parallel tests. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary
Closes #321
Restores the
#[cfg(test)] mod testsblock removed fromtests/bdd/fixtures/mod.rsby PR #273, adapted to the currentensure_env_lock/restore_environment_lockedsemantics:ensure_env_lock_acquires_lock_on_first_callensure_env_lock_is_idempotentensure_env_lock_captures_cwddrop_restores_cwd_after_ensure_env_lockThe two CWD-asserting tests are hardened relative to the pre-#273 originals: they hold an outer
EnvLock(re-entrant per thread) across the world's lifetime so a parallel test cannot move the process CWD between the world's drop and the assertion.Validation
cargo test --test bdd_tests fixtures::tests— 4 passedmake check-fmt/make lint/make test— pass (37 suites)🤖 Generated with Claude Code
Summary by Sourcery
Restore unit tests validating EnvLock environment synchronisation behavior in the BDD fixtures module.
Tests: