Tests in test_risk_filter.py fail when CI runs shortly after midnight UTC

オープン 初心者向け
#738 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 6 日以内に返信

@Majyles がすでに取り組んでいます。

2026年11月7日 から。

  • #742 @Majyles による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
fastapi, python
領域
api, testing

調査の方向性

src/tests/endpoints/test_risk_filter.pyを読み、まずtest_sequences_fromdate_pagination_filters_before_limitと、392行目付近にあるrisk_score=moderateのキルスイッチテストを確認してください。minutes_agoのシードとfrom_date=todayを組み合わせているファイル内の他のテストを探し、それらの日付が現在のUTC時刻に依存しないようにしてください。このファイルのpytestテストを実行してください。エンドポイントを変更せず、どの時刻でもテストが通れば完了です。

索引モデルが issue の本文から書いたものです。

説明

Context

The pytest job of #724 failed at 00:28 UTC on 2026-10-30 (run 40979934588) on two tests that the PR did not touch. A re-run during the day passed.

Cause

In src/tests/endpoints/test_risk_filter.py, test_sequences_fromdate_pagination_filters_before_limit and the risk_score=moderate kill-switch test (around line 392) seed sequences with _seed_unlabeled_sequence(..., minutes_ago=30..50) and then query /sequences/all/fromdate?from_date=<today UTC>. Within ~50 minutes after midnight UTC, the seeded sequences fall on the previous day and are not returned:

tests/endpoints/test_risk_filter.py:392: assert set(seeded).issubset(returned_ids) -> assert False
tests/endpoints/test_risk_filter.py:631: assert len(page) == 3 -> assert 1 == 3
What has to be done
  • Make these tests independent of the current UTC hour, e.g. seed at a fixed time earlier today (midnight + a few minutes) or derive from_date from the seeded started_at.
  • Check the other tests of the file that use the same minutes_ago + from_date=today pattern.
Done when
  • The file passes whatever the time of day
  • No endpoint change
主要言語
Python
スター
30
フォーク
15
平均マージ
7日 16時間
マージ済み PR(30日)
16

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pyronear/pyro-api のほかの issue

pyronear/pyro-api の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。