per_test_directory 0.1.0

fixture/attribute macro to create one directory per test run.
Documentation

per_test_directory

This crate introduces an attribute macro #[per_test_directory] that will create a directory test_runs/module_name.test_function_name and change the current working directory to it while running.

If the test is successful, the directory is removed. Otherwise, it is being kept for your inspection. Either way, the current directory is reset after the test run.

Example:

#[cfg(test)]
mod tests {
    use std::fs::File;
    use std::io::prelude;

    #[test]
    #[per_test_directory_macros]
    fn test_example() {
        let mut f = File::create("foo.txt")?;
        //actually in test_runs/tests.test_example/foo.txt
        file.write_all(b"hello");
        panic!("let's keep the file!");
    } }