You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3eb2ec1
Browse filesBrowse the repository at this point in the historyBrowse files
Build: share one test env guard in core (#1889) (#1891)
* Start fix for #1889
Assisted-by: Claude Code:claude-opus-5-5
* Share one env guard across core tests
Tests that change process env each wrote their own restore-on-drop
guard: 11 EnvGuard copies plus the with_env / with_home_env closures
and api::client's OrgResolutionEnvGuard. The copies drifted. Most
saved the previous value as a String, so a non-UTF-8 value was lost,
and the two closure helpers never restored env when the body panicked,
which leaked into the next #[serial] test.
Add crate::test_env with EnvGuard::{set, unset, many} and with_env.
It saves OsString values, restores newest-first and is panic-safe.
Every core unit test now uses it. The three integration tests that
had their own copy compile the same file in via #[path]. Tests only;
no production code changes.
Assisted-by: Claude Code:claude-opus-5-5
* Address review: env guard panic safety
- EnvGuard::many records each saved value before changing it, so a
panic partway through still restores the vars already changed.
- Move the guard's self-tests into test_env_tests.rs, so the
integration tests that #[path]-include test_env.rs don't run them
again.
- Put SOCKET_PROXY_URL under the guard in the org-resolution proxy
test instead of restoring it by hand after the asserts.
- Pass paths straight to EnvGuard::set instead of to_str().unwrap().
Assisted-by: Claude Code:claude-opus-5-5
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments