test(tui): serialize completion sound state
The completion sound settings test reads process-global sound state, while another notification test mutates it. Hold the existing module test lock so the default parallel harness cannot race the assertion back to beep mode. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -860,8 +860,8 @@ mod tests {
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
/// Serialise all tests that mutate `TERM_PROGRAM` to prevent data races
|
/// Serialise tests that mutate process-global environment or notification
|
||||||
/// when the test harness runs them in parallel threads.
|
/// sound state while the test harness runs them in parallel threads.
|
||||||
fn env_lock() -> std::sync::MutexGuard<'static, ()> {
|
fn env_lock() -> std::sync::MutexGuard<'static, ()> {
|
||||||
static LOCK: OnceLock<Mutex<()>> = OnceLock::new();
|
static LOCK: OnceLock<Mutex<()>> = OnceLock::new();
|
||||||
LOCK.get_or_init(|| Mutex::new(()))
|
LOCK.get_or_init(|| Mutex::new(()))
|
||||||
@@ -1331,6 +1331,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn settings_installs_custom_completion_sound_file() {
|
fn settings_installs_custom_completion_sound_file() {
|
||||||
|
let _lock = env_lock();
|
||||||
let config: crate::config::Config = toml::from_str(
|
let config: crate::config::Config = toml::from_str(
|
||||||
r#"
|
r#"
|
||||||
[notifications]
|
[notifications]
|
||||||
|
|||||||
Reference in New Issue
Block a user