Skip to content

chore(PLAN60): CI で tests/ の pytest を実行する (#141) - #202

Merged
takemi-ohama merged 4 commits into
mainfrom
ci/pytest
Sep 19, 2026
Merged

takemi-ohama merged 4 commits into
mainfrom
ci/pytest

Conversation

@takemi-ohama

Copy link
Copy Markdown
Contributor

Summary

  • .github/workflows/ci.yml に pytest ジョブを足す。uv sync --frozen で uv.lock から依存を入れ、Python 3.10(requires-python の下限)と 3.13(手元の uv が選ぶ版)で tests/ 全体を回す
  • 要求と受け入れ条件: issues/PLAN60_ci-pytest.md(モード light。本番コードは変えない)

Closes #141

Test plan

  • CI 相当(DEVBASE_ROOT 無し・HOME を空の tmp)で env -u DEVBASE_ROOT uv run --frozen pytest -q tests/ → 2682 passed、exit=0(本 PR の変更前の main、macOS)
  • この PR の CI で pytest ジョブ(3.10 / 3.13)が成功する(受け入れ条件 3)
  • テストを 1 件わざと落としたコミットで pytest ジョブが失敗する(受け入れ条件 4。確かめた後に戻す)

🤖 Generated with Claude Code

takemi-ohama and others added 2 commits September 18, 2026 20:38
- uv.lock から uv sync --frozen で依存を入れ、Python 3.10 / 3.13 で pytest tests/ を回す

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- entrypoint の gcloud 不在: /usr/bin を並べず bash だけを置いた PATH を作る (runner は /usr/bin/gcloud を持つ)
- tmux の terminal-overrides: 既定を固定値でなく空の設定を読ませた同じ tmux から取る
- cache の消せない控え: os.unlink でなく Path.unlink を差し替える (3.10 の pathlib は束縛済み)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@takemi-ohama takemi-ohama left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 1 | kiro | APPROVE

CI で pytest を走らせる変更として妥当です。テスト側の移植(gcloud を除いた PATH の隔離、tmux 既定値をバージョン非依存に比較、Python 3.10 向けの Path.unlink monkeypatch)はいずれも根拠が明確で、CI/ローカル差分を正しく吸収しています。openbao fixture はプロセス内 FakeOpenBao で docker/network 不要のため tests/env/test_cache.py の変更も CI 安全です。ブロッカーはありません。CI ジョブのタイムアウトについて minor を 1 件インラインに残しました。

Comment thread .github/workflows/ci.yml

@takemi-ohama takemi-ohama left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 1 | agy | REQUEST_CHANGES

CI の pytest ジョブ(Python 3.10 / 3.13)で tests/containers/test_tmux_conf.py が失敗しているため修正をお願いします。インラインコメントに修正アクションを記載しています。

Comment thread tests/containers/test_tmux_conf.py Outdated
Ubuntu の tmux は値の無い terminal-overrides 行を出し、_parse_options が
空文字を既定として積むため、追記後の値と一致しなかった。比べる前に空文字を除く。
あわせて pytest ジョブに timeout-minutes: 15 を付ける。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@takemi-ohama

Copy link
Copy Markdown
Contributor Author

🔧 /ndf:fix サマリ

対応件数: critical=1 / major=0 / minor=1 (合計 2 件)
deferred: 0 件 / rejected: 0 件
commit: 609dc5f
CI: FAILURE(修正前の run。push 後の再実行は未確認)

詳細

  • [critical] tests/containers/test_tmux_conf.py:163 — 既定を持たない tmux (Ubuntu) で _parse_options が空文字を積み比較が落ちていた。既定値から空文字を除いて比較するよう修正(CI の実ログの失敗と同一原因)。resolved
  • [minor] .github/workflows/ci.yml:48 — pytest ジョブに timeout-minutes: 15 を追加。resolved

検証: uv run --frozen pytest -q tests/containers/test_tmux_conf.py → 9 passed (exit 0, macOS tmux 3.7b)

@takemi-ohama takemi-ohama left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 2 | codex | REQUEST_CHANGES

仕様適合: PLAN60 の前提 2 を満たすため、依存定義と lock の不整合を CI で検出してください。

Comment thread .github/workflows/ci.yml Outdated

@takemi-ohama takemi-ohama left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 2 | kiro | APPROVE

light モードの CI 追加として範囲は一貫しており、テスト側の修正(Python 3.10 の pathlib が os.unlink をクラス定義時に束縛する差異 → Path.unlink を差し替え、GH runner の /usr/bin/gcloud 回避、tmux 既定値の版差を空設定との比較で吸収)はいずれも根拠が明確で正確です。docker/openbao/network 依存テストは fake/stub で隔離されており CI 用のマーカー除外は不要。修正を要する箇所は見つかりませんでした。

…いで落ちるようにする (#141)

--frozen は lock と pyproject.toml の整合を検査しない。PLAN60 前提 2 を満たすため --locked に変え、
続く uv run も揃えて --locked にする。PLAN60 の記述も合わせる。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@takemi-ohama

Copy link
Copy Markdown
Contributor Author

🔧 /ndf:fix サマリ

対応件数: critical=0 / major=1 / minor=0 (合計 1 件)
deferred: 0 件 / rejected: 0 件
commit: 08ffa23
CI: push 直後のため未確定

詳細

  • .github/workflows/ci.yml:62 — uv sync --frozen → uv sync --locked(lock と pyproject.toml の食い違いで落ちる)。pytest の実行も uv run --locked に揃えた。PLAN60 の前提 2・受け入れ条件 2・検証手段の記述を合わせた。手元で uv sync --locked exit 0、CI 相当の pytest 2682 passed。

@takemi-ohama takemi-ohama left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 3 | codex | APPROVE

修正が必要な指摘はありません。

@takemi-ohama takemi-ohama left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 cross-review | round 4 | kiro | APPROVE

CI 導入 (light) として範囲・意図が一貫。uv sync --locked / uv run --locked は PLAN60 の受け入れ条件 2 と整合し、lock ドリフトも CI で検知できる。テスト側の修正 (Ubuntu runner に /usr/bin/gcloud があるための no_gcloud_path、tmux 既定値を版依存にしない比較、Python 3.10 で os.unlink 差し替えが届かないための Path.unlink 差し替え) はいずれも CI 移植性のための妥当な変更で、実装詳細ではなく仕様・失敗系を検証している。修正を要する指摘は無し。

@takemi-ohama

Copy link
Copy Markdown
Contributor Author

検証結果(quality-gates / light)

段階 コマンド 対象範囲 実行時刻 結果
依存の整合 uv sync --locked lock と pyproject.toml 2026-09-18 21:15 exit=0
変更箇所の経路(手元・DEVBASE_ROOT あり) uv run --locked pytest -q tests/ 全体 2026-09-18 21:15 2682 passed / exit=0
変更箇所の経路(CI 相当・DEVBASE_ROOT 無し) env -u DEVBASE_ROOT uv run --locked pytest -q tests/ 全体 2026-09-18 21:17 2682 passed / exit=0
CI gh pr checks 202(head 08ffa23) Pytest 3.10 / 3.13・syntax・ruff・shellcheck 2026-09-18 21:14 すべて pass

受け入れ条件(issues/PLAN60_ci-pytest.md):

  • 1. PR と main への push で pytest ジョブが走る → この PR の checks に Pytest (Python 3.10) / (3.13)
  • 2. uv sync --locked で lock から入れる → ci.yml
  • 3. この PR の CI でジョブが成功 → head 08ffa23 で pass
  • 4. テストが落ちるとジョブが落ちる → 1 回目の run 35340612296 で実際の失敗 3 件によりジョブが fail(わざと落とす代わりに、この実例を証跡とした)
  • 5. 手元の結果が変わらない → 変更前 2682 passed、変更後 2682 passed
  • 6. CI で skip するテストは無い(CI の skip 2 件は既存の skipif: 実行環境の条件による既存のもの)

未検証の項目: なし
既存の失敗: なし
範囲外と判断したもの: なし

@takemi-ohama
takemi-ohama marked this pull request as ready for review September 18, 2026 12:19
@takemi-ohama
takemi-ohama merged commit 20868d8 into main Sep 19, 2026
7 checks passed
@takemi-ohama takemi-ohama mentioned this pull request Sep 19, 2026
3 tasks
@takemi-ohama
takemi-ohama deleted the ci/pytest branch September 22, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: CI が tests/ の pytest を実行していない

1 participant