Skip to content

Commit

Permalink
Rollup merge of #82349 - tmiasko:pretty-test-timeout, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
JohnTitor authored Feb 21, 2021
2 parents 8f61978 + 88753ce commit 9516484
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions library/test/src/formatters/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 9516484

Please sign in to comment.