Open yymm120 opened 2 months ago
In this case I had to place two configuration folders to make everything look normal. After this error, I'm not sure whether cargo test is trustworthy anymore. Should I always cargo run
@rustbot label -needs-triage @rustbot transfer cargo
As the reproduction steps involve third-party commands that I'm not as familiar with and is focusing on inferring the problem from screenshots rather than explicitly calling things out, this is going to be a guess as to what is going on .
It looks like the concern is with cargo run
running the binary in the current working directory while cargo test
is running the test harness in the package root.
This is expected behavior. cargo run
is trying to act as if you ran the binary directly. cargo test
needs a predictable location to run the test for accessing fixtures, independent of what your current working directory is.
I'm not too sure how config fits into this. In general, config is environmental configuration and is dependent on the current working directory that cargo
was run in.
@rustbot transfer cargo
TIL 😬
This is expected behavior.
cargo run
is trying to act as if you ran the binary directly.cargo test
needs a predictable location to run the test for accessing fixtures, independent of what your current working directory is.
For the reference, see the cargo-test doc:
The working directory when running each unit and integration test is set to the root directory of the package the test belongs to. Setting the working directory of tests to the package’s root directory makes it possible for tests to reliably access the package’s files using relative paths, regardless from where cargo test was executed from.
bug description
I placed the configuration folder in the root path and when I
cargo run
everything works fine. Butcargo test
keeps failing. It wants me to put the configuration folder inside src-axum.Then I found that
cargo test
andcargo run
output different resultscargo run
cargo test
environment
in workspace
os: ubuntu !❯ rustup --version rustup 1.27.1 (54dd3d00f 2024-04-24) info: This is the version for the rustup toolchain manager, not the rustc compiler. info: The currently active
rustc
version is `rustc 1.80.0 (051478957 2024-07-21)