[tor-commits] [sbws/maint-1.1] fix: test: Assert that caplog messages were found

juga at torproject.org juga at torproject.org
Tue Apr 14 13:53:20 UTC 2020


commit e9d5bb084aa0ba9a1e0aaac22b6732ffa3e40623
Author: juga0 <juga at riseup.net>
Date:   Mon Mar 23 09:19:08 2020 +0000

    fix: test: Assert that caplog messages were found
---
 tests/unit/lib/test_heartbeat.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/unit/lib/test_heartbeat.py b/tests/unit/lib/test_heartbeat.py
index 5c82a4b..f3d8f52 100644
--- a/tests/unit/lib/test_heartbeat.py
+++ b/tests/unit/lib/test_heartbeat.py
@@ -19,5 +19,9 @@ def test_total_measured_percent(conf, caplog):
     hbeat.print_heartbeat_message()
 
     assert hbeat.previous_measurement_percent == 67
-    caplog.records[1].getMessage().find("Measured in total 2 (67%)")
-    caplog.records[2].getMessage().find("1 relays still not measured")
+    assert 0 == caplog.records[1].getMessage().find(
+        "Measured in total 2 (67%)"
+    )
+    assert 0 == caplog.records[2].getMessage().find(
+        "1 relays still not measured"
+    )





More information about the tor-commits mailing list