Set RUST_TEST_THREADS=1 to run Rust tests sequentially or omit it to run them in parallel.
Use the RUST_TEST_THREADS environment variable to control parallelism: set it to 1 for sequential execution or omit it (or set it to a higher number) for parallel execution.
# Run tests sequentially (one at a time)
RUST_TEST_THREADS=1 cargo test
# Run tests in parallel (default behavior)
cargo test
By default, Rust runs all your tests at the same time to save time. If you set the RUST_TEST_THREADS variable to 1, it forces tests to run one after another. This is useful when a test changes shared data that affects other tests, ensuring they don't interfere with each other.