Skip to content

Suggest --ignored when libtest ignores a test #114818

Open
@jyn514

Description

@jyn514

Code

; cat src/lib.rs
#[test]
#[ignore = "takes too long 😩"]
fn i_am_slow() {
    std::thread::sleep(std::time::Duration::from_secs(5));
    println!("it works!");
}
; cargo test --lib --quiet

Current output

running 1 test
i
test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s

test: i_am_slow, ignore_message: takes too long 😩

Desired output

running 1 test
i
test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s

test: i_am_slow, ignore_message: takes too long 😩

note: to run ignored tests, use `--ignored`

Rationale and extra context

See rust-lang/cargo#12494; currently this will be confusing for people using cargo so I'd like to fix that issue first.

Other cases

If no tests are ignored, this help message shouldn't be printed.

Anything else?

No response

Metadata

Metadata

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-libtestArea: `#[test]` / the `test` library

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions