fix(test): register fastapi fixtures and correct sqlite fixture name - #7520
Open
rekha0suthar wants to merge 1 commit into
Open
fix(test): register fastapi fixtures and correct sqlite fixture name#7520rekha0suthar wants to merge 1 commit into
rekha0suthar wants to merge 1 commit into
Conversation
Three issues in chromadb/test/conftest.py broke test collection: fastapi, async_fastapi, and fastapi_persistent were plain functions without @pytest.fixture decorators. The system fixture uses request.getfixturevalue() with their names as params, which requires them to be registered fixtures. Without the decorator pytest raises 'fixture not found' at collection time. The same three functions used return instead of yield from, so the server teardown (system.stop() and proc.kill()) inside _fastapi_fixture never ran after tests completed. filtered_fixture_names() listed 'sqlite_fixture' which does not exist; the registered parameterized fixture is named 'sqlite'. Tests parameterized via the system fixture would skip the sqlite variant silently. Fixes: add @pytest.fixture() to the three functions, switch return to yield from, and rename 'sqlite_fixture' to 'sqlite' in the default fixture list. Fixes chroma-core#7395
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three related bugs in
chromadb/test/conftest.pythat prevent FastAPI fixtures from being discovered and cleaned up by pytest:fastapi,async_fastapi, andfastapi_persistentwere plain functions with no@pytest.fixture()decorator, sorequest.getfixturevalue()could not find them at runtime.return _fastapi_fixture(...)instead ofyield from _fastapi_fixture(...), meaning the generator's teardown code never executed after each test.filtered_fixture_names()listed"sqlite_fixture"which does not exist; the correct name is"sqlite".Changes
@pytest.fixture()tofastapi,async_fastapi, andfastapi_persistent.returntoyield fromin all three so teardown (server shutdown) runs after each test."sqlite_fixture"→"sqlite"infiltered_fixture_names().Test plan
request.getfixturevalue("fastapi")etc."sqlite"fixture resolves correctly in the filtered fixture list.🤖 Generated with Claude Code