diff --git a/tests/test_coder.py b/tests/test_coder.py index eee43897e..0fe2b5e83 100644 --- a/tests/test_coder.py +++ b/tests/test_coder.py @@ -121,8 +121,8 @@ class TestCoder(unittest.TestCase): self.assertEqual(result, 'a good "commit message"') @patch("aider.coder.openai.ChatCompletion.create") - @patch("aider.coder.time.sleep") - def test_send_with_retries_rate_limit_error(self, mock_sleep, mock_chat_completion_create): + @patch("aider.coder.backoff.expo") + def test_send_with_retries_rate_limit_error(self, mock_backoff_expo, mock_chat_completion_create): # Mock the IO object mock_io = MagicMock() @@ -139,12 +139,12 @@ class TestCoder(unittest.TestCase): # Call the send_with_retries method coder.send_with_retries("model", ["message"]) - # Assert that time.sleep was called once - mock_sleep.assert_called_once() + # Assert that backoff.expo was called once + mock_backoff_expo.assert_called_once() @patch("aider.coder.openai.ChatCompletion.create") - @patch("aider.coder.time.sleep") - def test_send_with_retries_connection_error(self, mock_sleep, mock_chat_completion_create): + @patch("aider.coder.backoff.expo") + def test_send_with_retries_connection_error(self, mock_backoff_expo, mock_chat_completion_create): # Mock the IO object mock_io = MagicMock() @@ -161,8 +161,8 @@ class TestCoder(unittest.TestCase): # Call the send_with_retries method coder.send_with_retries("model", ["message"]) - # Assert that time.sleep was called once - mock_sleep.assert_called_once() + # Assert that backoff.expo was called once + mock_backoff_expo.assert_called_once() if __name__ == "__main__":