What it does
Builds disposable, deterministic test environments. The most common
primitive is TempProject, which lets you stage a project tree, run
your test against it, and have the directory cleaned up on drop.
Quick start
[]
= "0.9.2"
use TempProject;
let project = new
.with_file
.with_file
.build
.unwrap;
// project.path() points at a temp directory.
// It is deleted automatically when `project` is dropped.
File-tree builders
use ;
let dir = tempdir.unwrap;
// One-line workspace.
rust_workspace.unwrap;
// Or build trees by hand.
new
.file
.dir
.file
.build
.unwrap;
Adversarial inputs
use adversarial;
let dir = tempdir.unwrap;
oversized_zeros.unwrap;
malformed_utf8.unwrap;
random_bytes.unwrap;
let names = unusual_names; // emoji, Unicode, dotted, etc.
Golden snapshots
use Golden;
let dir = tempdir.unwrap;
let g = new;
// First call creates the snapshot (verdict=Skip, tag=created).
let _ = g.compare;
// Subsequent calls verify (Pass / Fail with diff).
let check = g.compare;
assert!;
Set DEV_FIXTURES_UPDATE_GOLDEN=1 to regenerate snapshots on
intentional changes.
Mock data
use ;
// Deterministic CSV.
let csv = generate;
// Deterministic JSON array.
let json = generate;
// Raw bytes.
let zeroed = zeros;
let patterned = patterned;
let random = random;
dev-report integration
Wrap a fixture lifecycle as a Producer:
use ;
use Producer;
let producer = new;
let _report = producer.produce;
Or use Fixture::set_up_checked(name) directly to emit a
CheckResult tagged fixtures (and setup_failed + regression
on failure).
The dev-* suite
dev-fixtures is one of the producer crates in the dev-* verification
suite. See dev-tools for the
umbrella crate.
Status
v0.9.x is the pre-1.0 stabilization line. APIs are expected to be
near-final; minor adjustments may still happen ahead of 1.0.
Cleanup-on-drop and determinism guarantees are the contract.
Cross-platform support
Linux, macOS, and Windows. Symlink helpers are Unix-only and silently no-op on Windows; all other features behave identically across platforms.
Minimum supported Rust version
1.85 — pinned in Cargo.toml via rust-version and verified by
the MSRV job in CI. (Bumped from 1.75 because tempfile's
transitive dep getrandom requires edition2024, stabilized in
Rust 1.85.)
License
Apache-2.0. See LICENSE.