From 9238c01c3536b7679ea2694cbf4f56f563a2e9c2 Mon Sep 17 00:00:00 2001 From: Sheng Date: Mon, 21 Nov 2022 16:39:13 +0800 Subject: [PATCH] Updated test_failed_weak_ref --- tests/test_handler.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_handler.py b/tests/test_handler.py index 6a01cfb..dea82c4 100644 --- a/tests/test_handler.py +++ b/tests/test_handler.py @@ -283,9 +283,11 @@ class TestWsockHandler(unittest.TestCase): request = HTTPServerRequest(uri='/') obj = Mock(spec=WsockHandler, request=request) obj.src_addr = ("127.0.0.1", 8888) + class FakeWeakRef: def __init__(self): self.count = 0 + def __call__(self): self.count += 1 return None @@ -294,3 +296,4 @@ class TestWsockHandler(unittest.TestCase): obj.worker_ref = ref WsockHandler.on_message(obj, b'{"data": "somestuff"}') self.assertGreaterEqual(ref.count, 1) + obj.close.assert_called_with(reason='No worker found')