mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 18:25:00 +00:00
![]() # Context: USER: `tests/test_coder.py` `aider/coder.py` Fix the test_send_with_retries tests since we no longer use time.sleep but backoff instead ASSISTANT: To fix the test_send_with_retries tests in `tests/test_coder.py`, we need to update the tests to use the backoff library instead of time.sleep. Here's how to do it: 1. Replace the `@patch("aider.coder.time.sleep")` with `@patch("aider.coder.backoff.expo")` in both test_send_with_retries_rate_limit_error and test_send_with_retries_connection_error tests. 2. Update the test_send_with_retries_rate_limit_error and test_send_with_retries_connection_error tests to assert that backoff.expo was called once instead of time.sleep. Here are the changes: ```python tests/test_coder.py <<<<<<< ORIGINAL @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): >>>>>>> UPDATED ``` ```python tests/test_coder.py <<<<<<< ORIGINAL # 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() >>>>>>> UPDATED ``` ```python tests/test_coder.py <<<<<<< ORIGINAL @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): >>>>>>> UPDATED ``` ```python tests/test_coder.py <<<<<<< ORIGINAL # 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() >>>>>>> UPDATED ``` These changes should fix the test_send_with_retries tests in `tests/test_coder.py`. |
||
---|---|---|
.. | ||
__init__.py | ||
test_coder.py | ||
test_commands.py | ||
test_io.py | ||
test_main.py | ||
test_repomap.py | ||
test_utils.py |