-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cargo book doesn't specify which tests run in parallel and which tests run in fresh environment #10361
Comments
Firstly, in cargo each target compiles down to a crate, which usually refers to a compilation artifact such like a library or a executable. For unit test, cargo invokes rustc to collect all The aforementioned rule also applies on integration tests, all Things get interesting in doc tests. Cargo permits only one lib target for each package, and only compiles doc test for lib target. You might ask, does that implies a package gets exactly one executable for running doc tests? The answer is No. Doc tests current are controlled by Here is a table of my summary:
My knowledge might be rusty. Correct me if you find anything incorrect. |
Close as #10726 adds more sentences on this topic. Thanks for the report! cargo/src/doc/man/cargo-test.md Lines 30 to 54 in cce487e
|
Hi. I aware of 3 types of tests in Rust: unit tests, integration tests and doctests. I would like to see in documentation for
cargo test
in Cargo book and in Rustdoc book the following info: whether this tests run in parallel and whether every test is run in fresh environment, i. e. in new process created specially for this test. Please note that "sequential execution" and "execution of each test in fresh environment" are different things. Consider unit tests run usingcargo test -- --test-threads=1
. As well as I understand they will be run sequentially, but they still be run in the same process, thuschdir
and similar operations from one test will affect others. I want to see in cargo book and other docs answers to this questions:#[test]
functions from same file intests
) run in parallel?#[test]
functions from same file intests
) run in fresh environment?tests
run in parallel?tests
) run in fresh environment?Currently I was able to easily find answers to first two questions. But docs are vague on others. Section https://doc.rust-lang.org/rustdoc/documentation-tests.html doesn't answer questions on doctests
(moved from rust-lang/book#3042 and slightly edited)
The text was updated successfully, but these errors were encountered: