axum-extra tests fail except from git
Closed this issue · 2 comments
Running cargo test --all-targets --all-features
for crate axum-extra
fails like this:
1230s error: couldn't read /usr/share/cargo/registry/axum-extra-0.7.7/../axum/src/test_helpers/test_client.rs: No such file or directory (os error 2)
1230s --> src/lib.rs:113:9
1230s |
1230s 113 | / include!(concat!(
1230s 114 | | env!("CARGO_MANIFEST_DIR"),
1230s 115 | | "/../axum/src/test_helpers/test_client.rs"
1230s 116 | | ));
1230s | |__________^
1230s |
1230s = note: this error originates in the macro `include` (in Nightly builds, run with -Z macro-backtrace for more info)
1230s
1230s error: could not compile `axum-extra` due to previous error
The code expects to find files from crate axum
outside the crate source - same as how files are organized in the git source repository.
It is my understanding that tests should be possible to execute not only from a git checkout, but also from an unpacked crate.
It is my understanding that tests should be possible to execute not only from a git checkout, but also from an unpacked crate.
I don't think there's any official rules or recommendations about that. There was a Cargo behavior change a while ago that suggests the opposite though: automatically stripping path dev-dependencies without a version during publish.
I'll choose this for now since it's not clear why we would put an effort into making tests runnable from the published crate tarball.