#temp-dir #testing #temppath

macro tmp-path

Test helper to create a temporary directory

2 releases

0.1.1 Jan 5, 2025
0.1.0 Jan 4, 2025

#2553 in Development tools

Download history 517/week @ 2025-01-01 164/week @ 2025-01-08 7/week @ 2025-01-15 7/week @ 2025-01-22 94/week @ 2025-01-29 13/week @ 2025-02-05 6/week @ 2025-02-12 97/week @ 2025-02-19 8/week @ 2025-02-26

132 downloads per month
Used in python-project-generator

MIT license

4KB

tmp-path

This create contains a macro intended for test purposes that creates a temporary directory named tmp_path as a Pathbuff.

Installation

Note that you also need to install the tempfile crate.

cargo add --dev tmp-path tempfile

Usage

use std::fs::File;

use tmp_path::tmp_path;

#[test]
#[tmp_path]
fn test_example() {
    let test_file = &tmp_path.join("test_file");
    File::create(&test_file).unwrap();

    assert!(test_file.is_file());
}

Dependencies

~2–11MB
~146K SLoC