fix(tests): убрать реальные паузы из tradein-тестов (wave2)
All checks were successful
CI Trade-In / changes (pull_request) Successful in 11s
CI / changes (pull_request) Successful in 13s
CI Trade-In / browser-tests (pull_request) Has been skipped
CI Trade-In / frontend-checks (pull_request) Has been skipped
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
CI Trade-In / backend-tests (pull_request) Successful in 4m45s
All checks were successful
CI Trade-In / changes (pull_request) Successful in 11s
CI / changes (pull_request) Successful in 13s
CI Trade-In / browser-tests (pull_request) Has been skipped
CI Trade-In / frontend-checks (pull_request) Has been skipped
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
CI Trade-In / backend-tests (pull_request) Successful in 4m45s
- test_alerts_become_events.py: glitchtip_events() ждал sentry_sdk default shutdown_timeout=2.0с на client.close() в finally — 10 тестов по ~2.05с. Fix: client.close(timeout=0). - test_3398_estimator_valuations_proxy_pool.py::test_yandex_lease_released_once_on_success: успешный fetch_house_history зовёт настоящий anti-ban sleep_between_requests() (jitter вокруг request_delay_sec=5.0) — 6.05с. Мокнут scraper_kit.base.asyncio.sleep, lease-assert не тронут. - test_backfill_wave2.py::test_backfill_yandex_addresses_error_on_non_200: дефолтный анти-бот request_delay_sec=3.0 в backfill_yandex_addresses — 3.02с. Передан request_delay_sec=0 явно. Цели #2 (четыре теста по 5.01с, общий таймаут) и #3 (test_3033, два теста 7.82с/5.72с) уже были устранены в main до этой ветки — request_delay_sec=0 там уже проставлен, замер подтверждён (<1с каждый). Не тронуты: test_auth_api.py (bcrypt cost=12 + намеренный throttle), test_estimator_event_loop_2207.py (реальный sleep(0.3) — предмет теста). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JY6iWDnGDthdvsMWgK1BMG
This commit is contained in:
parent
cef872ace1
commit
8f57d6827c
3 changed files with 6 additions and 2 deletions
|
|
@ -342,6 +342,9 @@ def _yandex_with_pool(monkeypatch: pytest.MonkeyPatch, *, get: Any) -> _Counting
|
|||
patch(
|
||||
"scraper_kit.providers.yandex.valuation._CurlCffiSession", _fake_curl_session(get=get)
|
||||
),
|
||||
# На успехе fetch_house_history зовёт настоящий anti-ban sleep_between_requests
|
||||
# (5с jitter) — тесту нужен только факт release-lease, не сама пауза.
|
||||
patch("scraper_kit.base.asyncio.sleep", new_callable=AsyncMock),
|
||||
):
|
||||
_call_yandex(_db_cache_miss())
|
||||
return provider
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ def glitchtip_events() -> Iterator[list[dict[str, Any]]]:
|
|||
yield events
|
||||
finally:
|
||||
# Иначе на каждый тест остаётся фоновый поток транспорта.
|
||||
client.close()
|
||||
client.close(timeout=0)
|
||||
|
||||
|
||||
def event_texts(events: list[dict[str, Any]]) -> list[str]:
|
||||
|
|
|
|||
|
|
@ -215,7 +215,8 @@ async def test_backfill_yandex_addresses_error_on_non_200():
|
|||
return_value=mock_session,
|
||||
),
|
||||
):
|
||||
result = await backfill_yandex_addresses(MagicMock(), limit=10)
|
||||
# request_delay_sec=0: реальный анти-бот sleep(3с) тут не нужен, 1 item в батче.
|
||||
result = await backfill_yandex_addresses(MagicMock(), limit=10, request_delay_sec=0)
|
||||
|
||||
assert result.errors == 1
|
||||
assert result.saved == 0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue