Rollup merge of #82349 - tmiasko:pretty-test-timeout, r=Mark-Simulacrum

test: Print test name only once on timeout

Pretty formatter when using multiple test threads displays test name twice on
timeout event. This implicitly suggest that those are two different events,
while in fact they are always printed together.

Print test name only once.

Before:

```
running 3 tests
test src/lib.rs - c (line 16) ... ok
test src/lib.rs - a (line 3) ... ok
test src/lib.rs - b (line 9) ... test src/lib.rs - b (line 9) has been running for over 60 seconds
test src/lib.rs - b (line 9) ... ok
```

After:

```
running 3 tests
test src/lib.rs - c (line 16) ... ok
test src/lib.rs - a (line 3) ... ok
test src/lib.rs - b (line 9) has been running for over 60 seconds
test src/lib.rs - b (line 9) ... ok
```
This commit is contained in:
Yuki Okushi 2021-02-21 15:26:50 +09:00 committed by GitHub
commit d7fb4de791
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -222,10 +222,6 @@ impl<T: Write> OutputFormatter for PrettyFormatter<T> {
}
fn write_timeout(&mut self, desc: &TestDesc) -> io::Result<()> {
if self.is_multithreaded {
self.write_test_name(desc)?;
}
self.write_plain(&format!(
"test {} has been running for over {} seconds\n",
desc.name,