Skip to content

Commit 4ffc147

Browse files
committed
test(cli): keep cwd lock alive across path assertions
1 parent 33884ce commit 4ffc147

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

crates/solverforge-cli/src/commands/generate_domain/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ fn test_generate_data_loader_stub_is_compile_safe() {
151151

152152
#[test]
153153
fn test_remove_default_scaffold_rewrites_data_module_without_todo() {
154-
let _guard = test_support::lock_cwd();
154+
let guard = test_support::lock_cwd();
155155

156156
let tmp = tempfile::tempdir().expect("failed to create temp dir");
157157
let original_dir = std::env::current_dir().expect("failed to get current dir");
@@ -189,6 +189,7 @@ fn test_remove_default_scaffold_rewrites_data_module_without_todo() {
189189
std::env::set_current_dir(tmp.path()).expect("failed to enter temp dir");
190190
let result = remove_default_scaffold();
191191
std::env::set_current_dir(original_dir).expect("failed to restore current dir");
192+
drop(guard);
192193

193194
result.expect("remove_default_scaffold should succeed");
194195

crates/solverforge-cli/src/commands/sf_config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ mod tests {
125125

126126
#[test]
127127
fn preserves_arbitrary_view_shape_when_updating_constraints() {
128-
let _guard = test_support::lock_cwd();
128+
let guard = test_support::lock_cwd();
129129

130130
let tmp = tempfile::tempdir().expect("failed to create temp dir");
131131
let original_dir = std::env::current_dir().expect("failed to get current dir");
@@ -151,6 +151,7 @@ mod tests {
151151
let saved = std::fs::read_to_string(tmp.path().join("static").join("sf-config.json"))
152152
.expect("failed to read saved sf-config");
153153
std::env::set_current_dir(original_dir).expect("failed to restore current dir");
154+
drop(guard);
154155

155156
assert!(saved.contains("\"capacity_limit\""));
156157
assert!(saved.contains("\"assignment_board\""));

0 commit comments

Comments
 (0)