fix(tests): move store_with_profiles fixture to conftest.py so cross-module tests find it
This commit is contained in:
parent
ff4ab9d10d
commit
cfe56c3058
2 changed files with 26 additions and 25 deletions
26
tests/conftest.py
Normal file
26
tests/conftest.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
"""Shared pytest fixtures for kiwi test suite."""
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from app.db.store import Store
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def store_with_profiles(tmp_path):
|
||||
db_path = tmp_path / "test.db"
|
||||
store = Store(db_path)
|
||||
store.conn.execute("""
|
||||
INSERT INTO ingredient_profiles
|
||||
(name, elements, fat_pct, moisture_pct, glutamate_mg, binding_score,
|
||||
sodium_mg_per_100g, is_fermented, texture_profile)
|
||||
VALUES (?,?,?,?,?,?,?,?,?)
|
||||
""", ("butter", json.dumps(["Richness"]), 81.0, 16.0, 0.1, 0, 11.0, 0, "creamy"))
|
||||
store.conn.execute("""
|
||||
INSERT INTO ingredient_profiles
|
||||
(name, elements, fat_pct, moisture_pct, glutamate_mg, binding_score,
|
||||
sodium_mg_per_100g, is_fermented, texture_profile)
|
||||
VALUES (?,?,?,?,?,?,?,?,?)
|
||||
""", ("parmesan", json.dumps(["Depth", "Seasoning"]), 29.0, 29.0, 1.2, 1, 1600.0, 0, "neutral"))
|
||||
store.conn.commit()
|
||||
return store
|
||||
|
|
@ -1,30 +1,5 @@
|
|||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from app.db.store import Store
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def store_with_profiles(tmp_path):
|
||||
db_path = tmp_path / "test.db"
|
||||
store = Store(db_path)
|
||||
# Seed ingredient_profiles
|
||||
store.conn.execute("""
|
||||
INSERT INTO ingredient_profiles
|
||||
(name, elements, fat_pct, moisture_pct, glutamate_mg, binding_score,
|
||||
sodium_mg_per_100g, is_fermented, texture_profile)
|
||||
VALUES (?,?,?,?,?,?,?,?,?)
|
||||
""", ("butter", json.dumps(["Richness"]), 81.0, 16.0, 0.1, 0, 11.0, 0, "creamy"))
|
||||
store.conn.execute("""
|
||||
INSERT INTO ingredient_profiles
|
||||
(name, elements, fat_pct, moisture_pct, glutamate_mg, binding_score,
|
||||
sodium_mg_per_100g, is_fermented, texture_profile)
|
||||
VALUES (?,?,?,?,?,?,?,?,?)
|
||||
""", ("parmesan", json.dumps(["Depth", "Seasoning"]), 29.0, 29.0, 1.2, 1, 1600.0, 0, "neutral"))
|
||||
store.conn.commit()
|
||||
return store
|
||||
|
||||
|
||||
def test_classify_known_ingredient(store_with_profiles):
|
||||
from app.services.recipe.element_classifier import ElementClassifier
|
||||
|
|
|
|||
Loading…
Reference in a new issue