Skip to content

Commit

Permalink
integration-tests: Handles network issues when fetching corpora
Browse files Browse the repository at this point in the history
  • Loading branch information
funkyfuture committed May 12, 2024
1 parent 2239b76 commit 69038de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions integration-tests/fetch-corpora.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from typing import Final, NamedTuple

from httpx import AsyncClient, HTTPError
from tenacity import retry, wait_random_exponential

import delb

Expand Down Expand Up @@ -243,6 +244,7 @@ class Archive(NamedTuple):
http_client: Final = AsyncClient()


@retry(wait=wait_random_exponential(multiplier=1, max=120))
async def fetch_resource(url: str, destination: io.BufferedWriter) -> bool:
async with http_client.stream("GET", url, follow_redirects=True) as response:
try:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ coverage-report = """
[tool.hatch.envs.integration-tests]
dependencies = [
"pytest-httpx",
"tenacity",
"tqdm",
]
[tool.hatch.envs.integration-tests.scripts]
Expand Down

0 comments on commit 69038de

Please sign in to comment.