Skip to content

test(prompt): use explicit test credentials in test_prompt fixture - #2072

Open
AsherLucas wants to merge 1 commit into
langfuse:mainfrom
AsherLucas:fix-test-prompt-fixture-credentials
Open

AsherLucas wants to merge 1 commit into
langfuse:mainfrom
AsherLucas:fix-test-prompt-fixture-credentials

Conversation

@AsherLucas

@AsherLucas AsherLucas commented Oct 29, 2026 •

Copy link
Copy Markdown

Fixes #1976.

CONTRIBUTING says unit tests need no running server, but on a fresh clone without LANGFUSE_* env vars the langfuse fixture in tests/unit/test_prompt.py called Langfuse() with no arguments. The client then initializes disabled, and setting .api = Mock() raises AttributeError: Langfuse client is not initialized, erroring 18 tests.

Use the dummy credentials CI already uses (pk-lf-test / sk-lf-test, http://localhost:3000) so the fixture initializes on a fresh clone. No SDK behaviour change.

Before: pytest tests/unit/test_prompt.py -q -> 8 passed, 18 errors (no LANGFUSE_* env vars).
After: 26 passed.

RetriggerView in GreptileConfidence Score: 5/5

This PR appears safe to merge.

Summary

The prompt-test fixture now supplies dummy credentials and a localhost URL.

  • Prompt unit tests initialize their client with fixed test settings.

Reviews (1) · Last reviewed commit: "test(prompt): use explicit test credenti..." · Reviewed by Greptile

Fixes langfuse#1976: CONTRIBUTING says unit tests need no running server, but
the langfuse fixture called Langfuse() with no arguments, so without
LANGFUSE_* env vars the client was disabled and setting .api raised
AttributeError. Use the dummy credentials CI already uses so the
fixture initializes and the 18 erroring tests pass on a fresh clone.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

This branch has not been deployed

No deployments
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.

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

1 participant