ETest-Vue-FastAPI/test_service_detail.py

28 lines
874 B
Python
Raw Normal View History

2026-04-15 19:06:01 +08:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import asyncio
import sys
import traceback
sys.path.insert(0, 'ruoyi-fastapi-backend')
from sqlalchemy.ext.asyncio import create_async_engine, async_sessionmaker
from urllib.parse import quote_plus
DB_URL = f'mysql+asyncmy://cpy_admin:{quote_plus("Tgzz2025+")}@localhost:3307/ruoyi-fastapi'
async def test():
try:
from module_admin.service.warehouse_receipt_service import WarehouseReceiptService
engine = create_async_engine(DB_URL, echo=False)
AsyncSession = async_sessionmaker(engine, expire_on_commit=False)
async with AsyncSession() as db:
result = await WarehouseReceiptService.get_receipt_detail(db, 1011)
print(f"Result: {result}")
except Exception as e:
print(f"Error: {e}")
traceback.print_exc()
asyncio.run(test())