diff --git a/data/ignored/.gitignore b/data/ignored/.gitignore new file mode 100644 index 0000000..c54c073 --- /dev/null +++ b/data/ignored/.gitignore @@ -0,0 +1,3 @@ +# ignore everything except .gitignore, ensuring this directory actually exists +* +!.gitignore \ No newline at end of file diff --git a/src/model.rs b/src/model.rs index dd850f4..10e6a38 100644 --- a/src/model.rs +++ b/src/model.rs @@ -1510,9 +1510,10 @@ mod tests { #[test] fn set_str_param() { + let output_path = "data/ignored/test.vbc"; let mut model = Model::new() .hide_output() - .set_str_param("visual/vbcfilename", "test.vbc") + .set_str_param("visual/vbcfilename", output_path) .unwrap() .include_default_plugins() .create_prob("test") @@ -1527,8 +1528,11 @@ mod tests { assert_eq!(status, Status::Optimal); assert_eq!(solved_model.obj_val(), 3.); - assert!(Path::new("test.vbc").exists()); - fs::remove_file("test.vbc").unwrap(); + assert!(Path::new(output_path).exists()); + + // drop model so the file is closed and it can be removed + drop(solved_model); + fs::remove_file(output_path).unwrap(); } #[test]