fix(tests): move store_with_profiles fixture to conftest.py so cross-module tests find it
Some checks are pending
CI / Backend (Python) (push) Waiting to run
CI / Frontend (Vue) (push) Waiting to run
Mirror / mirror (push) Waiting to run

This commit is contained in:
pyr0ball 2026-07-07 22:00:54 -07:00
parent ff4ab9d10d
commit cfe56c3058
2 changed files with 26 additions and 25 deletions

26
tests/conftest.py Normal file
View 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

View file

@ -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