-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Cargo runs unit tests when they are disabled and --lib
is passed
#13668
Comments
Something similar seems to happen with benchmarks. With a manifest like this
Running |
This seems to be covered by rust-lang/testing-devex-team#1> Once we have a new JSON output format, Cargo could get more controls over tests than relying on libtest. |
I don't think this issue has anything to do with handling the output from the tests. It's all about which tests cargo decides to run. |
I see. Sorry I understood it wrong.
|
The proposed solution can only be solved with rust-lang/testing-devex-team#1, from my understanding, because Cargo needs to run libtest to know if there is any unit test defined. |
That's very surprising... but it explains a lot, thanks. |
make some doc comments not doc tests `./miri test --doc` will run doctests even if we have them disabled (that's a cargo quirk: rust-lang/cargo#13668). This fixes that command to not fail.
make some doc comments not doc tests `./miri test --doc` will run doctests even if we have them disabled (that's a cargo quirk: rust-lang/cargo#13668). This fixes that command to not fail.
Problem
When a crate has no unit tests (via
test = false
in its manifest), I would expect cargo to never ever try to run unit tests for that crate.And yet it turns out that
cargo test --lib
will run the unit tests.Steps
cargo test --lib --bins --examples --tests --benches
(in an attempt to run "everything except for doc tests"), or justcargo test --lib
Possible Solution(s)
--lib
should just be a filter, removing from the usual test set everything that's not a "library unit test". It should not add things that were not present to begin with.Notes
This is related to but different from #10936
Version
No response
The text was updated successfully, but these errors were encountered: