[tor-commits] [stem/master] Avoid 'never awaited' test warnings

atagar at torproject.org atagar at torproject.org
Sun Oct 18 00:02:00 UTC 2020


commit d018d6e29d62045e973c11dfebbac245fed3b51e
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Oct 17 15:48:24 2020 -0700

    Avoid 'never awaited' test warnings
    
    When running our tests with Python 3.8.5 I'm getting the following warnings...
    
            /home/atagar/Desktop/stem/test/unit/response/events.py:553: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
              controller.authenticate()
            RuntimeWarning: Enable tracemalloc to get the object allocation traceback
    
    Our mock spec doesn't provide anything here, so simply omitting it to silence
    these.
---
 test/unit/response/events.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/unit/response/events.py b/test/unit/response/events.py
index 33557874..f72a92bb 100644
--- a/test/unit/response/events.py
+++ b/test/unit/response/events.py
@@ -548,7 +548,7 @@ class TestEvents(unittest.TestCase):
         print_bw(_get_event('650 BW 15 25'))
         time.sleep(0.0005)
 
-    controller = Mock(spec = Controller)
+    controller = Mock()
 
     controller.authenticate()
     controller.add_event_listener(print_bw, EventType.BW)





More information about the tor-commits mailing list