Skip to content

Commit f5e8c80

Browse files
authored
test: Tune down DELTACHAT_SAVE_TMP_DB hint (#6998)
Follow-up for #6992 Since we're printing the hint to stderr now, rather than stdout (as per link2xt's suggestion), it was too noisy. Also, it was printed once for every test account rather than once per test. Now, it integrates nicely with rust's hint to enable a backtrace: ``` stderr ─── thread 'chat::chat_tests::test_broadcasts_name_and_avatar' panicked at src/chat/chat_tests.rs:2757:5: assertion failed: `(left == right)` Diff < left / right > : <true >false note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: If you want to examine the database files, set environment variable DELTACHAT_SAVE_TMP_DB=1 FAIL [ 0.265s] deltachat chat::chat_tests::test_broadcast ```
1 parent 58b99f5 commit f5e8c80

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/test_utils.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,8 +1082,6 @@ impl Drop for TestContext {
10821082
.join(format!("test-account-{}.db", self.name()));
10831083
tokio::fs::copy(from, &target).await.unwrap();
10841084
eprintln!("Copied database from {from:?} to {target:?}\n");
1085-
} else {
1086-
eprintln!("Hint: If you want to examine the database files, set environment variable DELTACHAT_SAVE_TMP_DB=1\n")
10871085
}
10881086
});
10891087
}
@@ -1168,6 +1166,11 @@ impl Drop for InnerLogSink {
11681166
while let Ok(event) = self.events.try_recv() {
11691167
print_logevent(&event);
11701168
}
1169+
if std::env::var("DELTACHAT_SAVE_TMP_DB").is_err() {
1170+
eprintln!(
1171+
"note: If you want to examine the database files, set environment variable DELTACHAT_SAVE_TMP_DB=1"
1172+
)
1173+
}
11711174
}
11721175
}
11731176

0 commit comments

Comments
 (0)