Skip to content

Commit 2fe2288

Browse files
sgrifweiznich
authored andcommitted
Partially fix our test suite on beta/nightly
Right now on beta the behavior of `file!` (or more specifically, the cwd when compiling the crate) has changed when running `cargo test`. It's unclear whether that change will be reverted or not, but it does point out how brittle these tests are. We want an absolute path, not a relative one, so using `CARGO_MANIFEST_DIR` instead seems like the way to go.
1 parent 8d0c159 commit 2fe2288

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

diesel_cli/tests/print_schema.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ const BACKEND: &str = "postgres";
5454
const BACKEND: &str = "mysql";
5555

5656
fn test_print_schema(test_name: &str, args: Vec<&str>) {
57-
let test_path = Path::new(file!())
58-
.parent()
59-
.unwrap()
57+
let test_path = Path::new(env!("CARGO_MANIFEST_DIR"))
58+
.join("tests")
6059
.join("print_schema")
6160
.join(test_name)
6261
.join(BACKEND);

0 commit comments

Comments
 (0)