1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Test utilities shared across modules.
//!
//! This module provides common utilities for tests, including
//! synchronization primitives for tests that modify global state.
use Mutex;
/// Mutex to serialize tests that depend on or change the current working directory.
///
/// Tests that either:
/// - Change the current working directory (e.g., to test non-git scenarios)
/// - Depend on the current working directory being a git repo
///
/// must acquire this mutex to prevent race conditions during parallel test execution.
///
/// # Example
///
/// ```ignore
/// use crate::test_utils::CWD_MUTEX;
///
/// #[test]
/// fn test_that_changes_cwd() {
/// let _lock = CWD_MUTEX.lock().unwrap();
/// // ... test code that changes or depends on cwd ...
/// }
/// ```
pub static CWD_MUTEX: = new;