自動テストスイートの追加 #6

Closed
opened 2026-09-14 15:03:54 +00:00 by joe · 2 comments
Owner

クローラーv2のUPSERT・重複判定・棄却ロジック等の自動テスト。

対象

  • to_int / is_search_page / is_grade_excluded のユニットテスト
  • upsert_cars の新規/更新/属性マッチ/棄却テスト
  • mark_sold_cars の sold_at 記録テスト
  • API(/api/cars profile_ids フィルタ等)の統合テスト

方針

  • pytest 導入、テスト用DBは実DBと分離
クローラーv2のUPSERT・重複判定・棄却ロジック等の自動テスト。 ## 対象 - [ ] to_int / is_search_page / is_grade_excluded のユニットテスト - [ ] upsert_cars の新規/更新/属性マッチ/棄却テスト - [ ] mark_sold_cars の sold_at 記録テスト - [ ] API(/api/cars profile_ids フィルタ等)の統合テスト ## 方針 - pytest 導入、テスト用DBは実DBと分離
Author
Owner

着手開始: pytest環境構築から。テスト用DBは実DBと分離する。

着手開始: pytest環境構築から。テスト用DBは実DBと分離する。
Author
Owner

完了(2026-09-27)

  • pytest 72テストに拡充(既存41 + API統合31)
  • 追加対象(全チェック済み):
    • ✅ to_int / is_search_page / is_detail_page / is_grade_excluded(既存41でカバー済み)
    • ✅ upsert_cars / mark_sold_cars(既存41でカバー済み)
    • ✅ /api/cars(profile_ids・エリア・価格・ソート・履歴付与)
    • ✅ /api/cars/{id}(200/404)/ /api/cars-by-ids / /api/stats
    • ✅ /api/profiles CRUD(重複409・論理削除・車両保持確認)
    • ✅ /api/grade-rules CRUD
    • ✅ /api/sites(site_definitions更新・新規作成)
  • API統合テストは実DBと完全分離(tmp_path + monkeypatch)
  • 過程で発見した BUG 修正: PUT /api/sites/{key} 新規INSERT のSQL組み立てエラー(Near "?" syntax error)→ main.py:1004 修正

テストDB分離確認済み(実DB rows=455 変化なし)。クローズします。

## 完了(2026-09-27) - pytest 72テストに拡充(既存41 + API統合31) - 追加対象(全チェック済み): - ✅ to_int / is_search_page / is_detail_page / is_grade_excluded(既存41でカバー済み) - ✅ upsert_cars / mark_sold_cars(既存41でカバー済み) - ✅ /api/cars(profile_ids・エリア・価格・ソート・履歴付与) - ✅ /api/cars/{id}(200/404)/ /api/cars-by-ids / /api/stats - ✅ /api/profiles CRUD(重複409・論理削除・車両保持確認) - ✅ /api/grade-rules CRUD - ✅ /api/sites(site_definitions更新・新規作成) - API統合テストは実DBと完全分離(tmp_path + monkeypatch) - 過程で発見した BUG 修正: PUT /api/sites/{key} 新規INSERT のSQL組み立てエラー(Near "?" syntax error)→ main.py:1004 修正 テストDB分離確認済み(実DB rows=455 変化なし)。クローズします。
joe closed this issue 2026-09-27 11:57:00 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
joe/findcar#6
No description provided.