()
| 19 | |
| 20 | @pytest.fixture |
| 21 | def fastapi_test_app(): |
| 22 | # Create temp registry and data directory |
| 23 | tmp_dir = tempfile.TemporaryDirectory() |
| 24 | registry_path = os.path.join(tmp_dir.name, "registry.db") |
| 25 | |
| 26 | # Create dummy parquet file (Feast requires valid sources) |
| 27 | parquet_file_path = os.path.join(tmp_dir.name, "data.parquet") |
| 28 | |
| 29 | df = pd.DataFrame( |
| 30 | { |
| 31 | "user_id": [1, 2, 3], |
| 32 | "age": [25, 30, 22], |
| 33 | "income": [50000.0, 60000.0, 45000.0], |
| 34 | "event_timestamp": pd.to_datetime( |
| 35 | ["2024-01-01", "2024-01-02", "2024-01-03"] |
| 36 | ), |
| 37 | } |
| 38 | ) |
| 39 | df.to_parquet(parquet_file_path) |
| 40 | |
| 41 | # Setup minimal repo config |
| 42 | config = { |
| 43 | "registry": registry_path, |
| 44 | "project": "demo_project", |
| 45 | "provider": "local", |
| 46 | "offline_store": {"type": "file"}, |
| 47 | "online_store": {"type": "sqlite", "path": ":memory:"}, |
| 48 | } |
| 49 | user_profile_source = FileSource( |
| 50 | name="user_profile_source", |
| 51 | path=parquet_file_path, |
| 52 | event_timestamp_column="event_timestamp", |
| 53 | ) |
| 54 | |
| 55 | store = FeatureStore(config=RepoConfig.model_validate(config)) |
| 56 | user_id_entity = Entity( |
| 57 | name="user_id", value_type=ValueType.INT64, description="User ID" |
| 58 | ) |
| 59 | user_profile_feature_view = FeatureView( |
| 60 | name="user_profile", |
| 61 | entities=[user_id_entity], |
| 62 | ttl=None, |
| 63 | schema=[ |
| 64 | Field(name="age", dtype=Int64), |
| 65 | Field(name="income", dtype=Float64), |
| 66 | ], |
| 67 | source=user_profile_source, |
| 68 | tags={"environment": "production", "team": "ml", "version": "1.0"}, |
| 69 | ) |
| 70 | user_behavior_feature_view = FeatureView( |
| 71 | name="user_behavior", |
| 72 | entities=[user_id_entity], |
| 73 | ttl=None, |
| 74 | schema=[ |
| 75 | Field(name="click_count", dtype=Int64), |
| 76 | Field(name="session_duration", dtype=Float64), |
| 77 | ], |
| 78 | source=user_profile_source, |
nothing calls this directly
no test coverage detected