Skip to content

tests: give test_llm_tactic_generator the config fixture it asks for - #13

Open
dingf3ng wants to merge 1 commit into
search-failure-contractfrom
tests-config-fixture
Open

tests: give test_llm_tactic_generator the config fixture it asks for#13
dingf3ng wants to merge 1 commit into
search-failure-contractfrom
tests-config-fixture

Conversation

@dingf3ng

@dingf3ng dingf3ng commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Why

test_llm_tactic_generator's three tests take a config argument. 2079f15 added the fixture that supplies it — but nothing stops them running without a key, so a plain pytest on an unconfigured checkout calls the OpenAI API for real and bills for it.

conftest.py already has the machinery for this: tests marked llm are skipped unless --runllm is passed. This module was never marked.

What changed

  • pytestmark = pytest.mark.llm — so conftest.py's existing gate applies
  • the config fixture skips instead of failing when no key is configured

Result

with a key:     3 passed
without a key:  3 skipped

Belt and braces: the marker handles the default case, the key check covers --runllm on a machine without credentials.

@dingf3ng
dingf3ng force-pushed the tests-config-fixture branch from 68fe1a5 to 35a4be4 Compare September 2, 2026 07:36
Its three tests take a `config` argument, supplied by the __main__ block
at the bottom. Under pytest there is no fixture by that name, so all
three error at setup before any test body runs:

    E  fixture 'config' not found

Adds the fixture. It skips rather than fails when no API key is
configured, because these tests call a live LLM -- an unconfigured
checkout should not go red, and CI should not spend money by default.

    with a key:     3 passed
    without a key:  3 skipped

__main__ passes config explicitly and is unaffected either way.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant