tests/unit/test_prompt.py fails on a fresh clone without LANGFUSE_* env vars
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
失敗しているセットアップは 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 の本文から書いたものです。
説明
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):
- 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"), sotests/unitis self-contained as CONTRIBUTING.md describes. - 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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
langfuse/langfuse-python のほかの issue
-
bug: ChatPromptClient.compile appends str(whole list) once per non-dict placeholder item対応中かも @hassiebp が 1 日前に担当しました。 オープンbug feat-prompt-management sdk-python
langfuse/langfuse-python#1971 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
bug: LANGFUSE_MAX_EVENT_SIZE_BYTES is parsed but never enforced for score events対応中かも @hassiebp が 2 日前に担当しました。 オープンbug feat-scores sdk-python
langfuse/langfuse-python#1966 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
bug: non-numeric status in a 207 error entry raises inside handle_exception, kills the score consumer thread, flush()/shutdown() then hang対応中かも @hassiebp が 2 日前に担当しました。 オープン[Integrations] Language Clients bug feat-scores sdk-python
langfuse/langfuse-python#1967 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
bug: Partial-failure (207) ingestion response retries the whole batch up to 3x; per-item error details only logged at DEBUG対応中かも @hassiebp が 2 日前に担当しました。 オープンbug feat-ingestion
langfuse/langfuse-python#1965 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
bug: GCS upload detection in MediaManager uses substring match on the full URL対応中かも @hassiebp が 10 日前に担当しました。 オープンbug feat-multimodal-media sdk-python
langfuse/langfuse-python#1913 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
langfuse/langfuse-python の issue をすべて見る
似ている issue
-
[BUG] Container scenario crashes without expected_recovery_time, kube DNS example uses retry_waitオープンneeds-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
krkn-chaos/krkn#1627 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NousResearch/hermes-agent#136483 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
[BUG] LazyStackedTensorDictStore zeroes the last byte of a new key set on the last element対応中かも @peterdsharpe が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
pytorch/tensordict#2307 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信