tests/unit/test_prompt.py fails on a fresh clone without LANGFUSE_* env vars
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 80/100
Hướng nghiên cứu
Thiết lập đang lỗi là fixture langfuse tại tests/unit/test_prompt.py:132, fixture này gọi Langfuse() không có tham số. Hãy tái hiện bằng cách bỏ đặt các biến LANGFUSE_* rồi chạy uv run --frozen pytest tests/unit/test_prompt.py -q, sau đó so sánh với env ở cấp job trong .github/workflows/ci.yml:65-67. Công việc được coi là xong khi 18 lỗi biến mất khi không có biến môi trường, hoặc CONTRIBUTING.md ghi rõ các export cần thiết. Hãy xác nhận với một maintainer xem họ ưu tiên cách sửa nào trong hai cách được đề xuất trước khi chỉnh sửa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 498
- Fork
- 361
- Merge trung bình
- 16 giờ 40 phút
- Pull request đã merge (30 ngày)
- 38
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của langfuse/langfuse-python
-
bug(langchain): failed streaming LLM runs retain IDs in callback memoCó thể đã có người làm @hassiebp đã nhận 1 ngày trước. Đang mởbug integration-langchain sdk-python
langfuse/langfuse-python#1977 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: ChatPromptClient.compile appends str(whole list) once per non-dict placeholder itemCó thể đã có người làm @hassiebp đã nhận 2 ngày trước. Đang mởbug feat-prompt-management sdk-python
langfuse/langfuse-python#1971 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: LANGFUSE_MAX_EVENT_SIZE_BYTES is parsed but never enforced for score eventsCó thể đã có người làm @hassiebp đã nhận 2 ngày trước. Đang mởbug feat-scores sdk-python
langfuse/langfuse-python#1966 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: non-numeric status in a 207 error entry raises inside handle_exception, kills the score consumer thread, flush()/shutdown() then hangCó thể đã có người làm @hassiebp đã nhận 2 ngày trước. Đang mở[Integrations] Language Clients bug feat-scores sdk-python
langfuse/langfuse-python#1967 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: Partial-failure (207) ingestion response retries the whole batch up to 3x; per-item error details only logged at DEBUGCó thể đã có người làm @hassiebp đã nhận 2 ngày trước. Đang mởbug feat-ingestion
langfuse/langfuse-python#1965 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của langfuse/langfuse-python
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
lugassawan/swe-workbench#799 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
vllm-project/vllm#61131 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Non-string form field names raise AttributeError when files are attachedCó thể đã có người làm @nightcityblade đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
kubernetes-client/python#2735 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
desktop help wanted test
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày