Skip to content

Commit

Permalink
Handle exception when getting a build
Browse files Browse the repository at this point in the history
```
requests.exceptions.ConnectionError: ('Connection aborted.',
  RemoteDisconnected('Remote end closed connection without response'))
```
  • Loading branch information
nkaretnikov committed Dec 10, 2023
1 parent f5e6c69 commit 26fa036
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import aiohttp
import conda_store_server
import pytest
import requests
from conda_store_server import schema
from pydantic import parse_obj_as

Expand Down Expand Up @@ -976,7 +977,11 @@ def test_api_cancel_build(testclient):
building = False
start = time.time()
while time.time() - start < build_timeout:
response = testclient.get(f"api/v1/build/{new_build_id}")
try:
response = testclient.get(f"api/v1/build/{new_build_id}")
except requests.exceptions.ConnectionError:
time.sleep(5)
continue
response.raise_for_status()

r = schema.APIGetBuild.parse_obj(response.json())
Expand Down

0 comments on commit 26fa036

Please sign in to comment.