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
//! Test-only seam for pointing config-dir-based stores (`auth::file_store`,
//! `mcp::store`) at a temp directory without mutating process-wide env vars.
//!
//! `pidge_core::paths::config_dir()` reads `HOME`/`XDG_CONFIG_HOME` (on
//! Linux and macOS alike), which are global to
//! the whole process. Two independent test modules each overriding those
//! vars behind their own lock can still race across threads within one test
//! binary: one test's `HOME` swap or restore can land mid-flight in
//! another. A thread-local override avoids the problem outright: it is
//! visible only to the thread that set it, so parallel `#[test]` functions
//! on different threads never interfere, and no lock is required at all.
//! See `crate::config_dir`, which consults this before falling back to
//! `pidge_core::paths::config_dir()`. The override is pidge's own config
//! directory (the folder holding `tokens/` and `mcp/`), not its parent.
use RefCell;
use ;
thread_local!
/// Run `f` with pidge's config dir pinned to `dir` for the current thread,
/// restoring whatever was there before (including across a panic inside
/// `f`) once `f` returns.
pub
/// The override set by [`with_base_dir`] for the current thread, if any.
pub