From b612a33eb965cb68f4a94039f784051eeb0956d3 Mon Sep 17 00:00:00 2001 From: Luke Lombardi Date: Thu, 11 Jan 2024 16:04:18 -0500 Subject: [PATCH] fix tests --- sdk/Makefile | 2 +- sdk/tests/test_queue.py | 32 ++++++++++++++++++++++---------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/sdk/Makefile b/sdk/Makefile index 2a5b54242..6d72a1167 100644 --- a/sdk/Makefile +++ b/sdk/Makefile @@ -7,7 +7,7 @@ docs: @poetry run ./bin/docgen.py 2>/dev/null tests: - BEAM_SERIALIZE_MODE=start poetry run pytest -s + poetry run pytest -s format: poetry run black . diff --git a/sdk/tests/test_queue.py b/sdk/tests/test_queue.py index a1419110b..fdd30aae0 100644 --- a/sdk/tests/test_queue.py +++ b/sdk/tests/test_queue.py @@ -22,14 +22,14 @@ def setUp(self): def test_put(self): mock_stub = MagicMock() - mock_stub.put = mock_coroutine_with_result(SimpleQueuePutResponse(ok=True)) + mock_stub.simple_queue_put = mock_coroutine_with_result(SimpleQueuePutResponse(ok=True)) queue = SimpleQueue(name="test") queue.stub = mock_stub self.assertTrue(queue.put("test")) - mock_stub.put = mock_coroutine_with_result(SimpleQueuePutResponse(ok=False)) + mock_stub.simple_queue_put = mock_coroutine_with_result(SimpleQueuePutResponse(ok=False)) queue = SimpleQueue(name="test") queue.stub = mock_stub @@ -41,7 +41,7 @@ def test_pop(self): pickled_value = cloudpickle.dumps("test") - mock_stub.pop = mock_coroutine_with_result( + mock_stub.simple_queue_pop = mock_coroutine_with_result( SimpleQueuePopResponse(ok=True, value=pickled_value) ) @@ -50,7 +50,9 @@ def test_pop(self): self.assertEqual(queue.pop(), "test") - mock_stub.pop = mock_coroutine_with_result(SimpleQueuePopResponse(ok=False, value=b"")) + mock_stub.simple_queue_pop = mock_coroutine_with_result( + SimpleQueuePopResponse(ok=False, value=b"") + ) queue = SimpleQueue(name="test") queue.stub = mock_stub @@ -62,7 +64,7 @@ def test_peek(self): pickled_value = cloudpickle.dumps("test") - mock_stub.peek = mock_coroutine_with_result( + mock_stub.simple_queue_peek = mock_coroutine_with_result( SimpleQueuePeekResponse(ok=True, value=pickled_value) ) @@ -71,7 +73,9 @@ def test_peek(self): self.assertEqual(queue.peek(), "test") - mock_stub.peek = mock_coroutine_with_result(SimpleQueuePeekResponse(ok=False, value=b"")) + mock_stub.simple_queue_peek = mock_coroutine_with_result( + SimpleQueuePeekResponse(ok=False, value=b"") + ) queue = SimpleQueue(name="test") queue.stub = mock_stub @@ -81,14 +85,18 @@ def test_peek(self): def test_empty(self): mock_stub = MagicMock() - mock_stub.empty = mock_coroutine_with_result(SimpleQueueEmptyResponse(ok=True, empty=True)) + mock_stub.simple_queue_empty = mock_coroutine_with_result( + SimpleQueueEmptyResponse(ok=True, empty=True) + ) queue = SimpleQueue(name="test") queue.stub = mock_stub self.assertTrue(queue.empty()) - mock_stub.empty = mock_coroutine_with_result(SimpleQueueEmptyResponse(ok=False, empty=True)) + mock_stub.simple_queue_empty = mock_coroutine_with_result( + SimpleQueueEmptyResponse(ok=False, empty=True) + ) queue = SimpleQueue(name="test") queue.stub = mock_stub @@ -98,14 +106,18 @@ def test_empty(self): def test_size(self): mock_stub = MagicMock() - mock_stub.size = mock_coroutine_with_result(SimpleQueueSizeResponse(ok=True, size=1)) + mock_stub.simple_queue_size = mock_coroutine_with_result( + SimpleQueueSizeResponse(ok=True, size=1) + ) queue = SimpleQueue(name="test") queue.stub = mock_stub self.assertEqual(len(queue), 1) - mock_stub.size = mock_coroutine_with_result(SimpleQueueSizeResponse(ok=False, size=1)) + mock_stub.simple_queue_size = mock_coroutine_with_result( + SimpleQueueSizeResponse(ok=False, size=1) + ) queue = SimpleQueue(name="test") queue.stub = mock_stub