Attribute Macro serial_test_derive::file_serial
source · [−]#[file_serial]
Expand description
Allows for the creation of file-serialised Rust tests
#[test]
#[file_serial]
fn test_serial_one() {
// Do things
}
#[test]
#[file_serial]
fn test_serial_another() {
// Do things
}
Multiple tests with the file_serial attribute are guaranteed to run in serial, as per the serial attribute. Note that there are no guarantees about one test with serial and another with file_serial as they lock using different methods, and file_serial does not support nested serialised tests, but otherwise acts like serial.
It also supports an optional path
arg e.g
#[test]
#[file_serial(key, "/tmp/foo")]
fn test_serial_one() {
// Do things
}
#[test]
#[file_serial(key, "/tmp/foo")]
fn test_serial_another() {
// Do things
}
Note that in this case you need to specify the name
arg as well (as per serial). The path defaults to a reasonable temp directory for the OS if not specified.