mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
throttle added
This commit is contained in:
parent
ff4ad07a2b
commit
2fb6a99956
1 changed files with 12 additions and 0 deletions
|
|
@ -1,12 +1,24 @@
|
|||
# tests/test_address_to_uprn_csv.py
|
||||
|
||||
import csv
|
||||
import time
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
from backend.address2UPRN.main import get_uprn
|
||||
|
||||
FIXTURE_PATH = Path(__file__).parent / "test_data.csv"
|
||||
|
||||
# Delay between live EPC API calls to stay under the (undocumented) rate limit.
|
||||
# Each parametrized case fires at least one EPC request; without throttling,
|
||||
# GitHub-hosted runners burst fast enough to hit 429s.
|
||||
EPC_THROTTLE_SECONDS = 1.0
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _throttle_epc_requests():
|
||||
yield
|
||||
time.sleep(EPC_THROTTLE_SECONDS)
|
||||
|
||||
|
||||
def load_test_cases():
|
||||
with open(FIXTURE_PATH, newline="", encoding="utf-8") as f:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue