Skip to content

Commit

Permalink
fix: 正确的 mock 函数
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 committed Jan 29, 2024
1 parent e27502a commit dfbe745
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/publish/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ async def handle_pr_close(
else:
logger.info("发布的拉取请求未合并,已跳过")

# GitHub 的缓存一般 1 分钟左右会刷新
await asyncio.sleep(60)
# 如果商店更新则触发 registry 更新
if event.payload.pull_request.merged:
# GitHub 的缓存一般 1 分钟左右会刷新
await asyncio.sleep(60)
await trigger_registry_update(bot, repo_info, publish_type, issue)
else:
logger.info("拉取请求未合并,跳过触发商店列表更新")
Expand Down
2 changes: 2 additions & 0 deletions tests/publish/process/test_pull_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ async def test_process_pull_request(app: App, mocker: MockerFixture) -> None:

mock_subprocess_run = mocker.patch("subprocess.run")
mock_sleep = mocker.patch("asyncio.sleep")
mock_sleep.return_value = None

mock_issue = mocker.MagicMock()
mock_issue.state = "open"
Expand Down Expand Up @@ -203,6 +204,7 @@ async def test_process_pull_request_skip_plugin_test(

mock_subprocess_run = mocker.patch("subprocess.run")
mock_sleep = mocker.patch("asyncio.sleep")
mock_sleep.return_value = None

mock_issue = mocker.MagicMock()
mock_issue.state = "open"
Expand Down

0 comments on commit dfbe745

Please sign in to comment.