Skip to content

Commit

Permalink
Add retry in URL tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Oct 11, 2024
1 parent dfeb170 commit e0b672a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/test_app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import time

import pytest
import requests

Expand Down Expand Up @@ -30,7 +32,12 @@
)
def test_url(url: str, params: dict[str, str], timeout: int) -> None:
"""Tests that some URL didn't return an error."""
response = requests.get(url, params=params, verify=False, timeout=timeout) # nosec
response = None
for _ in range(5):
response = requests.get(url, params=params, verify=False, timeout=timeout) # nosec
if response.status_code != 503:
break
time.sleep(1)
assert response.status_code == 200, response.text


Expand Down

0 comments on commit e0b672a

Please sign in to comment.