Skip to content

Commit

Permalink
Updated test_download_images.py to make it run faster
Browse files Browse the repository at this point in the history
  • Loading branch information
zoeduan committed Jul 30, 2024
1 parent 463d147 commit fd9f8b2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/test_download_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def test_successful_download_with_subfolder(self, get_mock):


@patch('requests.get')
def test_success_after_retries(self, get_mock):
@patch('time.sleep', return_value=None)
def test_success_after_retries(self,sleep_mock, get_mock):
retry_status_codes = [429, 500, 502, 503, 504]
for status_code in retry_status_codes:
with self.subTest(status_code=status_code):
Expand All @@ -112,7 +113,8 @@ def test_success_after_retries(self, get_mock):
self.assertTrue(os.path.isfile(f"{self.IMG_DIR}/{filename}"))

@patch('requests.get')
def test_failure_after_retries(self, get_mock):
@patch('time.sleep', return_value=None)
def test_failure_after_retries(self, sleep_mock,get_mock):
retry_status_codes = [429, 500, 502, 503, 504]
for status_code in retry_status_codes:
with self.subTest(status_code=status_code):
Expand Down

0 comments on commit fd9f8b2

Please sign in to comment.