diff --git a/app/services/enhanced_adb_service.py b/app/services/enhanced_adb_service.py index 5198445..b284294 100644 --- a/app/services/enhanced_adb_service.py +++ b/app/services/enhanced_adb_service.py @@ -3,13 +3,13 @@ """ import asyncio from typing import List, Optional, AsyncGenerator -from app.core.adb_client import AdbClient +from app.core.adb import AdbClient from app.models.adb_models import ( DeviceInfo, DeviceEvent, ForwardInfo, ServerInfo, ShellCommand, ShellResponse, ForwardRequest ) from app.utils.log import get_enhanced_logger, LogLevel -from app.core.adb_exceptions import AdbConnectionError, AdbProtocolError +from app.core.exceptions import AdbConnectionError, AdbProtocolError logger = get_enhanced_logger(__name__, LogLevel.DEBUG) diff --git a/modify.md b/modify.md index eb54090..cdd30b9 100644 --- a/modify.md +++ b/modify.md @@ -51,4 +51,11 @@ ### python-multipart依赖启用 - 在 `requirements.txt` 中启用了 `python-multipart==0.0.6` 依赖 - 解决了FastAPI路由注册时提示需要安装python-multipart的错误 -- 虽然代码中没有直接使用表单数据,但FastAPI在某些情况下会自动检测到可能需要处理表单数据 \ No newline at end of file +- 虽然代码中没有直接使用表单数据,但FastAPI在某些情况下会自动检测到可能需要处理表单数据 + +### 导入路径修复 +- 修复了 `app/services/enhanced_adb_service.py` 中错误的导入路径 +- 将 `from app.core.adb_client import AdbClient` 改为 `from app.core.adb import AdbClient` +- 将 `from app.core.adb_exceptions import ...` 改为 `from app.core.exceptions import ...` +- 修复了 `test_exception_handling.py` 中的多个导入路径错误 +- 解决了 "No module named 'app.core.adb_client'" 的导入错误 \ No newline at end of file diff --git a/test_exception_handling.py b/test_exception_handling.py index 0671a21..fb9b76d 100644 --- a/test_exception_handling.py +++ b/test_exception_handling.py @@ -4,11 +4,11 @@ """ import asyncio import requests -from app.core.app_factory import create_development_app -from app.core.adb_exceptions import ( +from app.core.app.factory import create_development_app +from app.core.exceptions import ( AdbConnectionError, AdbProtocolError, AdbDeviceNotFoundError ) -from app.core.adb_exceptions import ( +from app.core.exceptions import ( BusinessError, ValidationError, ResourceNotFoundError, PermissionError ) @@ -70,7 +70,7 @@ def test_error_response_format(): """测试错误响应格式""" print("\n=== 测试错误响应格式 ===") - from app.core.exception_handlers import ErrorResponse + from app.core.handlers.exception_handlers import ErrorResponse # 创建标准错误响应 error_response = ErrorResponse(