File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,12 +13,18 @@ mod tests {
1313 use rexpect:: spawn;
1414 use std:: fs:: File ;
1515 use std:: io:: { Read , Write } ;
16+ use std:: sync:: Mutex ;
1617 use tempfile:: tempdir;
1718
19+ // These tests rely on pty semantics and can behave flakily when executed concurrently.
20+ // Serialize them to ensure stable behavior under the default Rust test runner.
21+ static INTERACTIVE_TEST_LOCK : Mutex < ( ) > = Mutex :: new ( ( ) ) ;
22+
1823 // It should behave the same on windows, but interactive testing relies on unix pty internals.
1924 #[ test]
2025 #[ cfg( not( target_os = "windows" ) ) ]
2126 fn test_it_confirms_before_overwriting_a_file ( ) {
27+ let _guard = INTERACTIVE_TEST_LOCK . lock ( ) . unwrap ( ) ;
2228 let d = tempdir ( ) . unwrap ( ) ;
2329 let f = d. as_ref ( ) . join ( "test.out" ) ;
2430
@@ -54,6 +60,7 @@ mod tests {
5460 #[ test]
5561 #[ cfg( not( target_os = "windows" ) ) ]
5662 fn test_it_confirms_before_overwriting_a_file_and_quits ( ) {
63+ let _guard = INTERACTIVE_TEST_LOCK . lock ( ) . unwrap ( ) ;
5764 let d = tempdir ( ) . unwrap ( ) ;
5865 let f = d. as_ref ( ) . join ( "test.out" ) ;
5966
You can’t perform that action at this time.
0 commit comments