-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: make building examples optional in cargo test
#12430
Comments
Thanks for the idea. There are some design issue there. Like, Stepping back a bit. I wonder whether |
An alternate solution to this might be #6945 where you could change the default for all examples in one place. |
I get that. It was just an example of a similar type of flag.
It probably is sufficient. It is what I currently use when muscle memory doesn't take over. So I can live with the current behaviour or if this request is closed as "won't fix". I understand the intent (as laid out in the doc quote above) and that there probably isn't any other place to ensure that examples actually build. I also understand that 300+ examples an extreme edge case and most crates have less than 5 so most devs wouldn't see the extra overhead. However, it feels wrong that building the examples is part of running tests and/or that it isn't at least a configurable option. The other part of Finally, I'm not making an argument that examples (or doctests) shouldn't be built or run, just that I should be able to control when and how they are built/run. |
Yes. That would work for me. The example your give in that FR |
Thanks for the clarification! Going to close this in favor of #6945. Please let us know if this should remain open :) |
No. That is fine. Thanks for the consideration. |
Problem
I have a crate with 300 example files and every time I run
cargo test
it builds all of these files before running the tests. That takes ~85% of the time to run the test suite (35 sec in total and 5 sec for the 700 tests):As far as I can see from the documentation there isn't any way to not build the examples when running tests. The Cargo book says the following:
Turning off each example in
[[example]]
sections isn't a viable option (for me) with 300 examples and more to come.Proposed Solution
I'd like to see a flag in Cargo.toml to turn off automatic building of examples. Something similar to the
doctests
flag:Notes
If there is agreement on having this as a new flag I can volunteer to implement it.
The text was updated successfully, but these errors were encountered: