Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

tests/unit/test_prompt.py fails on a fresh clone without LANGFUSE_* env vars

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

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

まだ誰も着手していません。

評価

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

調査の方向性

失敗しているセットアップは tests/unit/test_prompt.py:132 の langfuse フィクスチャで、引数なしで Langfuse() を呼び出しています。LANGFUSE_* 変数を未設定にして uv run --frozen pytest tests/unit/test_prompt.py -q を実行して再現し、その後 .github/workflows/ci.yml:65-67 のジョブレベルの env と比較してください。環境変数なしで 18 件のエラーが消えるか、CONTRIBUTING.md に必要なエクスポートが記載されていれば完了です。編集する前に、提案されている2つの修正案のどちらを好むかをメンテナーに確認してください。

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

説明

bug feat-prompt-management sdk-python

CONTRIBUTING.md says unit tests don't require a running Langfuse server, but on a fresh clone with no LANGFUSE_* env vars set, 18 tests in tests/unit/test_prompt.py error during fixture setup:

AttributeError: Langfuse client is not initialized
langfuse/_client/client.py:497

The langfuse fixture (tests/unit/test_prompt.py:132) calls Langfuse() with no arguments. Without LANGFUSE_PUBLIC_KEY, the client initializes as disabled (_resources is None), so the api setter raises when the fixture assigns Mock().

Repro (latest main):

uv sync --locked
env -u LANGFUSE_PUBLIC_KEY -u LANGFUSE_SECRET_KEY -u LANGFUSE_BASE_URL \
  uv run --frozen pytest tests/unit/test_prompt.py -q
# 8 passed, 18 errors

With dummy keys exported, all 26 pass (full tests/unit: 885 passed).

This passes in CI because the unit-test job sets LANGFUSE_PUBLIC_KEY=pk-lf-test, LANGFUSE_SECRET_KEY=sk-lf-test and LANGFUSE_BASE_URL=http://localhost:3000 at the job level (.github/workflows/ci.yml:65-67), so the gap only shows up locally.

Proposed fix (either works, happy to go with whichever you prefer):

  1. Pass the same dummy credentials CI uses explicitly in the fixture, e.g. Langfuse(public_key="pk-lf-test", secret_key="sk-lf-test", base_url="http://localhost:3000"), so tests/unit is self-contained as CONTRIBUTING.md describes.
  2. Or, if relying on env vars is intentional, add a note to CONTRIBUTING.md telling contributors to export these values before running unit tests.

Happy to open a PR if this is welcome.

主要言語
Python
スター
498
フォーク
361
平均マージ
16時間 40分
マージ済み PR(30日)
38

環境構築

はじめの一歩

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

langfuse/langfuse-python のほかの issue

langfuse/langfuse-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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