Browse Source

daoru

master
hyh 4 months ago
parent
commit
94c28b8dba
  1. 4
      app/services/enhanced_adb_service.py
  2. 7
      modify.md
  3. 8
      test_exception_handling.py

4
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)

7
modify.md

@ -52,3 +52,10 @@
- 在 `requirements.txt` 中启用了 `python-multipart==0.0.6` 依赖
- 解决了FastAPI路由注册时提示需要安装python-multipart的错误
- 虽然代码中没有直接使用表单数据,但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'" 的导入错误

8
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(

Loading…
Cancel
Save