test: refactor tests and fix inference edge cases
- Convert protocol and MoE test classes to plain functions - Add real server/engine integration and generate_async tests - Isolate test model per test and use pytest tmp_path - Reset FastAPI engine state after inference tests - Fix generate_async StopIteration handling on Python 3.12 - Fix HF adapter MoE dense/shared and Gemma qk_norm mapping - Correct dev dependency httpx2 to httpx
This commit is contained in:
@@ -8,6 +8,13 @@ from fastapi.testclient import TestClient
|
||||
from astrai.inference import get_app
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _cleanup_app_engine():
|
||||
"""Reset the lazy FastAPI singleton engine after each inference test."""
|
||||
yield
|
||||
get_app().state.engine = None
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client():
|
||||
"""Provide a test client for the FastAPI app."""
|
||||
|
||||
Reference in New Issue
Block a user