Skip to content

Commit a5f3024

Browse files
committed
feat: Optimize database test processThis commit introduces several improvements to the database test workflow:* **Pydantic v2 Adaptation:** Updated the test suite to be fully compatible with Pydantic v2, ensuring smooth operation and leveraging the latest features.* **Disable Multipart Logging:** Suppressed verbose multipart logging during tests to improve readability and reduce unnecessary output.
1 parent f80db9e commit a5f3024

9 files changed

Lines changed: 521 additions & 560 deletions

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ jobs:
185185
uses: docker/metadata-action@v4
186186
with:
187187
images: |
188-
shinonomeow/auto_bangumi
188+
estrellaxd/auto_bangumi
189189
ghcr.io/${{ github.repository }}
190190
tags: |
191191
type=raw,value=${{ needs.version-info.outputs.version }}
@@ -197,7 +197,7 @@ jobs:
197197
uses: docker/metadata-action@v4
198198
with:
199199
images: |
200-
shinonomeow/auto_bangumi
200+
estrellaxd/auto_bangumi
201201
ghcr.io/${{ github.repository }}
202202
tags: |
203203
type=raw,value=${{ needs.version-info.outputs.version }}
@@ -258,7 +258,7 @@ jobs:
258258
builder: ${{ steps.buildx.output.name }}
259259
platforms: linux/amd64,linux/arm64,linux/arm/v7
260260
push: false
261-
tags: shinonomeow/auto_bangumi:test
261+
tags: estrellaxd/auto_bangumi:test
262262
cache-from: type=gha, scope=${{ github.workflow }}
263263
cache-to: type=gha, scope=${{ github.workflow }}
264264

backend/src/module/conf/log.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ def setup_logger(level: int = logging.INFO, reset: bool = False):
1717
logging.addLevelName(logging.DEBUG, "DEBUG:")
1818
logging.addLevelName(logging.INFO, "INFO:")
1919
logging.addLevelName(logging.WARNING, "WARNING:")
20-
LOGGING_FORMAT = "[%(asctime)s] %(levelname)-8s %(message)s"
20+
LOGGING_FORMAT = "[%(asctime)s] %(levelname)-8s [%(name)s] %(message)s"
2121
TIME_FORMAT = "%Y-%m-%d %H:%M:%S"
2222

2323
# 获取根日志器
2424
root_logger = logging.getLogger()
2525

26-
# 如果已经有处理器且不是重置模式,则更新现有配置
27-
if root_logger.handlers and not reset:
26+
# 如果已经有处理器,则更新现有配置
27+
if root_logger.handlers:
2828
# 更新根日志器的等级
2929
root_logger.setLevel(level)
3030
# 更新所有处理器的等级
@@ -56,6 +56,7 @@ def setup_logger(level: int = logging.INFO, reset: bool = False):
5656
"passlib",
5757
"multipart",
5858
"multipart.multipart",
59+
"python_multipart.multipart",
5960
]
6061
for logger_name in loggers_to_silence:
6162
logger = logging.getLogger(logger_name)

backend/src/module/database/bangumi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22

3-
from sqlmodel import Session, and_, delete, false, or_, select
3+
from sqlmodel import Session, and_, delete, false, select
44

55
from module.models import Bangumi
66

backend/src/module/models/response.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33

44
class ResponseModel(BaseModel):
5-
status: bool = Field(..., example=True)
6-
status_code: int = Field(..., example=200)
5+
status: bool = Field(..., json_schema_extra={"example": True})
6+
status_code: int = Field(..., json_schema_extra={"example": 200})
77
msg_en: str
88
msg_zh: str
99

1010

1111
class APIResponse(BaseModel):
12-
status: bool = Field(..., example=True)
13-
msg_en: str = Field(..., example="Success")
14-
msg_zh: str = Field(..., example="成功")
12+
status: bool = Field(..., json_schema_extra={"example": True})
13+
msg_en: str = Field(..., json_schema_extra={"example": "Success"})
14+
msg_zh: str = Field(..., json_schema_extra={"example": "成功"})

backend/src/module/network/request_contents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async def get_torrents(
5353
retry: int = 3,
5454
) -> list[Torrent]:
5555
feeds = await self.get_xml(_url, retry)
56-
if feeds:
56+
if feeds is not None:
5757
torrent_titles, torrent_urls, torrent_homepage = rss_parser(feeds)
5858
torrents: list[Torrent] = []
5959
for _title, torrent_url, homepage in zip(torrent_titles, torrent_urls, torrent_homepage):

0 commit comments

Comments
 (0)