[tor-commits] [stem/master] Hide expected unit test log messages

atagar at torproject.org atagar at torproject.org
Sat Jul 18 00:39:41 UTC 2020


commit f31876a66931ee45a273572d8082d0144d0c8d8a
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Jul 16 17:03:52 2020 -0700

    Hide expected unit test log messages
    
    When our unit tests are ran with NOTICE runlevel logging we output two
    messages...
    
      % ./run_tests.py --unit --log NOTICE
      ...
    
      control.controller...                                success (0.76s)
      Event listener raised an uncaught exception (boom): CIRC 4 LAUNCHED
      Tor sent a malformed event (A BW event's bytes sent and received should be a positive numeric value, received: BW &15* 25): BW &15* 25
    
    These arise from legitimate failure scenario tests. These log messages are
    harmless but confusing, so might as well hide 'em.
---
 test/unit/control/controller.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/test/unit/control/controller.py b/test/unit/control/controller.py
index 6c33da6b..f1ad9209 100644
--- a/test/unit/control/controller.py
+++ b/test/unit/control/controller.py
@@ -583,6 +583,7 @@ class TestControl(unittest.TestCase):
     self._emit_event(BW_EVENT)
     self.bw_listener.assert_called_once_with(BW_EVENT)
 
+  @patch('stem.util.log.warn', Mock())
   def test_event_listing_with_error(self):
     """
     Raise an exception in an event listener to confirm it doesn't break our
@@ -599,6 +600,7 @@ class TestControl(unittest.TestCase):
     self._emit_event(BW_EVENT)
     self.bw_listener.assert_called_once_with(BW_EVENT)
 
+  @patch('stem.util.log.error', Mock())
   def test_event_listing_with_malformed_event(self):
     """
     Attempt to parse a malformed event emitted from Tor. It's important this





More information about the tor-commits mailing list