gendesign/tradein-mvp/backend/tests/scrapers
bot-backend 57963e3a06 test(tradein): reusable legacy/scraper_kit parity harness (#2304)
Stage 0 of the scraper_kit migration epic (#2277): shared test tool for
issues #2305-#2310, which each need to prove their kit-path importer
produces the same output as the legacy path on the same input.

- tests/support/parity.py: assert_parity()/compare_outputs() normalize
  dataclass/pydantic outputs to dict/list/scalar before comparing, since
  legacy vs kit dataclasses (e.g. DetailEnrichment) are different classes
  and dataclass __eq__ always returns False across classes even when all
  field values match. Supports ignore_fields (drop non-deterministic
  fields like latency_ms/fetched_at) and numeric tolerance (math.isclose)
  for float fields, with an assertion listing every differing field
  (path + legacy value + kit value) on mismatch.
- tests/support/test_parity.py: unit tests for the harness itself
  (identical outputs pass, differing outputs raise with informative
  diff, tolerance/ignore_fields options, cross-class dataclass parity).
- tests/scrapers/test_avito_detail_kit_parity.py: end-to-end smoke proof
  against real code — app.services.scrapers.avito_detail.parse_detail_html
  (legacy, reached via admin.py's scrape_avito_detail debug endpoint
  through fetch_detail) vs scraper_kit.providers.avito.detail's copy, on
  a fixed HTML fixture.
- tests/support/README.md: usage note for #2305-#2310 migration PRs.

Found while implementing: tests/test_scraper_kit_*_parity.py (9 files,
~3400 lines) already do ad-hoc `dataclasses.asdict(old) == asdict(new)`
parity checks for the already-migrated SERP scraper modules (avito/cian/
domclick/yandex/base/scheduler/pipeline) — this harness generalizes that
repeated pattern for the remaining 12 non-scraper importers, adding
ignore_fields/tolerance which those ad-hoc checks don't have.
2026-07-03 23:45:58 +03:00
..
__init__.py fix(tradein/avito): anti-bot hardening — sleep + abort + shared session (#487) 2026-05-23 20:08:40 +00:00
test_avito_403_backconnect_reconnect.py fix(avito): gate 403 reconnect-retry on proxy presence only, not rotate_url absence 2026-06-18 21:31:20 +03:00
test_avito_429_bucket_skip.py fix(avito): tolerate 429 per-bucket instead of banning whole sweep 2026-06-18 23:03:28 +03:00
test_avito_anti_bot.py fix(scrapers): avito pipeline — новостройки house graceful (без housePage), AvitoBlockedError per-item не крашит прогон (#1820) 2026-06-20 09:53:46 +03:00
test_avito_detail_403_reconnect.py fix(avito): reconnect-retry on detail 403/firewall under backconnect proxy 2026-06-18 22:12:03 +03:00
test_avito_detail_429_reconnect.py fix(avito): reconnect-retry on detail 429 under backconnect proxy 2026-06-18 23:29:47 +03:00
test_avito_detail_browser_only.py fix(scrapers): avito_detail_backfill — снапшот ЕКБ+active, detail browser-only без curl-fallback на бан (#1814) 2026-06-19 21:58:35 +03:00
test_avito_detail_kit_parity.py test(tradein): reusable legacy/scraper_kit parity harness (#2304) 2026-07-03 23:45:58 +03:00
test_avito_detail_not_found.py fix(tradein/avito): reap dead 404 listings in detail backfill (don't trip block breaker) 2026-06-28 14:05:31 +03:00
test_avito_detail_soft_block.py fix(tradein/avito): detect HTTP-200 soft-block → rotate + coords-priority backfill ordering (#1950, #1967) 2026-06-28 08:06:12 +00:00
test_avito_detail_warmup.py fix(tradein/avito-detail): живой прогрев сессии + батч-на-сессию — снимает 403 на curl-backfill (#1551) 2026-06-28 22:34:38 +00:00
test_avito_exhaustive.py fix(tradein): avito _extract_total_count returns 0 on no-results page (stop empty-bracket split waste + fallback-listing scrape) 2026-06-18 20:01:41 +03:00
test_avito_imv_browser_transport.py feat(tradein-imv): route IMV backfill через BrowserFetcher.fetch_json за dormant-флагом (#915 Stage 3) (#1916) 2026-06-26 09:54:28 +00:00
test_avito_incremental_pagination.py feat(avito): incremental SERP pagination with date early-stop (param-gated, default off) 2026-06-18 22:01:46 +03:00
test_avito_sweep_retry.py fix(tradein): avito sweep page-level retry — transient page error no longer aborts run 2026-06-18 14:29:01 +03:00
test_avito_unix_date_tz_consistency.py fix(scrapers/avito): unify _unix_to_date timezone across serp/houses/imv (#2129) 2026-07-02 14:03:11 +00:00
test_browser_fetcher.py feat(tradein-browser): additive POST /fetch-json + BrowserFetcher.fetch_json (#915 Stage 2) (#1915) 2026-06-26 09:30:35 +00:00
test_cian_exhaustive.py feat(scrapers): cian SERP на BrowserFetcher (camoufox), снят code-side rotate (#1806) 2026-06-19 20:41:44 +03:00
test_domclick.py feat(tradein/domclick): enrich Layer A SERP parser — description, repair-inference, minhash, seller 2026-06-27 16:35:25 +03:00
test_domclick_detail.py feat(tradein/domclick): local-runner + ingest tooling → main (split from parked Layer-B) 2026-06-28 10:26:52 +03:00
test_price_brackets.py perf(tradein): shared EKB seed price-brackets across avito/cian/yandex (city-dict ready for multi-city) 2026-06-18 17:55:55 +03:00