restructure project
This commit is contained in:
@@ -11,8 +11,8 @@ from fastapi.testclient import TestClient
|
||||
from PIL import Image
|
||||
import io
|
||||
|
||||
from src.web.app import create_app
|
||||
from src.web.config import ModelConfig, StorageConfig, AppConfig
|
||||
from inference.web.app import create_app
|
||||
from inference.web.config import ModelConfig, StorageConfig, AppConfig
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -87,8 +87,8 @@ class TestHealthEndpoint:
|
||||
class TestInferEndpoint:
|
||||
"""Test /api/v1/infer endpoint."""
|
||||
|
||||
@patch('src.inference.pipeline.InferencePipeline')
|
||||
@patch('src.inference.yolo_detector.YOLODetector')
|
||||
@patch('inference.pipeline.pipeline.InferencePipeline')
|
||||
@patch('inference.pipeline.yolo_detector.YOLODetector')
|
||||
def test_infer_accepts_png_file(
|
||||
self,
|
||||
mock_yolo_detector,
|
||||
@@ -150,8 +150,8 @@ class TestInferEndpoint:
|
||||
|
||||
assert response.status_code == 422 # Unprocessable Entity
|
||||
|
||||
@patch('src.inference.pipeline.InferencePipeline')
|
||||
@patch('src.inference.yolo_detector.YOLODetector')
|
||||
@patch('inference.pipeline.pipeline.InferencePipeline')
|
||||
@patch('inference.pipeline.yolo_detector.YOLODetector')
|
||||
def test_infer_returns_cross_validation_if_available(
|
||||
self,
|
||||
mock_yolo_detector,
|
||||
@@ -210,8 +210,8 @@ class TestInferEndpoint:
|
||||
# This test documents that it should be added
|
||||
|
||||
|
||||
@patch('src.inference.pipeline.InferencePipeline')
|
||||
@patch('src.inference.yolo_detector.YOLODetector')
|
||||
@patch('inference.pipeline.pipeline.InferencePipeline')
|
||||
@patch('inference.pipeline.yolo_detector.YOLODetector')
|
||||
def test_infer_handles_processing_errors_gracefully(
|
||||
self,
|
||||
mock_yolo_detector,
|
||||
@@ -280,16 +280,16 @@ class TestInferenceServiceImports:
|
||||
|
||||
This test will fail if there are ImportError issues like:
|
||||
- from ..inference.pipeline (wrong relative import)
|
||||
- from src.web.inference (non-existent module)
|
||||
- from inference.web.inference (non-existent module)
|
||||
|
||||
It ensures the imports are correct before runtime.
|
||||
"""
|
||||
from src.web.services.inference import InferenceService
|
||||
from inference.web.services.inference import InferenceService
|
||||
|
||||
# Import the modules that InferenceService tries to import
|
||||
from src.inference.pipeline import InferencePipeline
|
||||
from src.inference.yolo_detector import YOLODetector
|
||||
from src.pdf.renderer import render_pdf_to_images
|
||||
from inference.pipeline.pipeline import InferencePipeline
|
||||
from inference.pipeline.yolo_detector import YOLODetector
|
||||
from shared.pdf.renderer import render_pdf_to_images
|
||||
|
||||
# If we got here, all imports work correctly
|
||||
assert InferencePipeline is not None
|
||||
|
||||
Reference in New Issue
Block a user