From e954df1369c151443c6a6369ad765f526a23a53e Mon Sep 17 00:00:00 2001 From: sturmianseq Date: Thu, 5 Aug 2021 08:35:59 +0000 Subject: [PATCH] Improve test reliability by resetting the pre-state in test_mock_queue_connection --- redisqueue/mock.py | 5 +++++ tests/test_redisqueue.py | 1 + 2 files changed, 6 insertions(+) diff --git a/redisqueue/mock.py b/redisqueue/mock.py index 7198db1..7422d96 100644 --- a/redisqueue/mock.py +++ b/redisqueue/mock.py @@ -34,6 +34,11 @@ def connect(self, **kwargs): return self.connected + def disconnect(self, **kwargs): + self.connected = False + + return self.connected + def clear(self): self._items = [] self._item_lock = [] diff --git a/tests/test_redisqueue.py b/tests/test_redisqueue.py index 5b1f520..209cd3a 100644 --- a/tests/test_redisqueue.py +++ b/tests/test_redisqueue.py @@ -43,6 +43,7 @@ def unique_hash(self): def test_mock_queue_connection(): + mock_queue.disconnect() assert mock_queue.connected is False with pytest.raises(QueueNotConnectedError):