perf(tradein-tests): убрать реальные паузы из тестов, волна 2 (#3503)
Some checks failed
Deploy Trade-In / build-backend (push) Blocked by required conditions
Deploy Trade-In / deploy (push) Blocked by required conditions
Deploy Trade-In / perimeter-smoke (push) Blocked by required conditions
Deploy Trade-In / deploy-status (push) Blocked by required conditions
Deploy Trade-In / changes (push) Successful in 13s
Deploy Trade-In / build-frontend (push) Has been skipped
Deploy Trade-In / build-browser (push) Has been skipped
Deploy Trade-In / test (push) Has been cancelled

Co-authored-by: bot-backend <bot-backend@gendsgn.local>
Co-committed-by: bot-backend <bot-backend@gendsgn.local>
This commit is contained in:
bot-backend 2026-09-12 14:15:21 +00:00 committed by lekss361
parent 98a582e242
commit 162e101636
3 changed files with 6 additions and 2 deletions

View file

@ -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

View file

@ -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]:

View file

@ -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