From ce7fdc7e3f97befb5c912f9b778f6aa185c1bb28 Mon Sep 17 00:00:00 2001 From: uy/sun Date: Wed, 11 Dec 2024 16:13:38 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=8B=86=E5=88=86=20models=20?= =?UTF-8?q?=E5=92=8C=20handlers=20=E9=81=BF=E5=85=8D=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=20(#323)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/github/config.py | 2 +- src/plugins/github/depends/__init__.py | 3 ++- src/plugins/github/handlers/__init__.py | 3 +++ src/plugins/github/{models => handlers}/git.py | 0 .../github/{models => handlers}/github.py | 6 ++++-- .../github/{models => handlers}/issue.py | 4 +++- .../github/{models/__init__.py => models.py} | 7 ------- src/plugins/github/plugins/config/__init__.py | 3 +-- src/plugins/github/plugins/config/utils.py | 2 +- src/plugins/github/plugins/publish/__init__.py | 2 +- src/plugins/github/plugins/publish/utils.py | 2 +- .../github/plugins/publish/validation.py | 2 +- src/plugins/github/plugins/remove/__init__.py | 3 +-- src/plugins/github/plugins/remove/utils.py | 2 +- src/plugins/github/plugins/resolve/__init__.py | 3 +-- .../github/publish/utils/test_comment_issue.py | 9 ++++++--- .../publish/utils/test_ensure_issue_content.py | 9 ++++++--- .../test_ensure_issue_plugin_test_button.py | 12 ++++++++---- ...t_publish_resolve_conflict_pull_requests.py | 18 ++++++++++++------ .../utils/test_trigger_registry_update.py | 15 ++++++++++----- .../utils/test_validate_info_from_issue.py | 4 ++-- .../utils/test_remove_resolve_pull_requests.py | 9 ++++++--- 22 files changed, 71 insertions(+), 49 deletions(-) create mode 100644 src/plugins/github/handlers/__init__.py rename src/plugins/github/{models => handlers}/git.py (100%) rename src/plugins/github/{models => handlers}/github.py (98%) rename src/plugins/github/{models => handlers}/issue.py (97%) rename src/plugins/github/{models/__init__.py => models.py} (77%) diff --git a/src/plugins/github/config.py b/src/plugins/github/config.py index 39493cc0..cf7b8db0 100644 --- a/src/plugins/github/config.py +++ b/src/plugins/github/config.py @@ -2,7 +2,7 @@ from pydantic import BaseModel, ConfigDict, Field, field_validator -from src.plugins.github.models import RepoInfo +from .models import RepoInfo class PublishConfig(BaseModel): diff --git a/src/plugins/github/depends/__init__.py b/src/plugins/github/depends/__init__.py index 619be003..b083fb2f 100644 --- a/src/plugins/github/depends/__init__.py +++ b/src/plugins/github/depends/__init__.py @@ -11,7 +11,8 @@ from nonebot.params import Depends from src.plugins.github.constants import CONFIG_LABEL, PUBLISH_LABEL, REMOVE_LABEL -from src.plugins.github.models import GithubHandler, IssueHandler, RepoInfo +from src.plugins.github.handlers import GithubHandler, IssueHandler +from src.plugins.github.models import RepoInfo from src.plugins.github.typing import IssuesEvent, LabelsItems, PullRequestEvent from src.plugins.github.utils import run_shell_command from src.providers.validation.models import PublishType diff --git a/src/plugins/github/handlers/__init__.py b/src/plugins/github/handlers/__init__.py new file mode 100644 index 00000000..d9ff3485 --- /dev/null +++ b/src/plugins/github/handlers/__init__.py @@ -0,0 +1,3 @@ +from .git import GitHandler as GitHandler +from .github import GithubHandler as GithubHandler +from .issue import IssueHandler as IssueHandler diff --git a/src/plugins/github/models/git.py b/src/plugins/github/handlers/git.py similarity index 100% rename from src/plugins/github/models/git.py rename to src/plugins/github/handlers/git.py diff --git a/src/plugins/github/models/github.py b/src/plugins/github/handlers/github.py similarity index 98% rename from src/plugins/github/models/github.py rename to src/plugins/github/handlers/github.py index 5d9b92b5..901eea95 100644 --- a/src/plugins/github/models/github.py +++ b/src/plugins/github/handlers/github.py @@ -8,7 +8,9 @@ from pydantic import ConfigDict from src.plugins.github.constants import NONEFLOW_MARKER -from src.plugins.github.models import GitHandler, RepoInfo +from src.plugins.github.models import RepoInfo + +from .git import GitHandler class GithubHandler(GitHandler): @@ -249,7 +251,7 @@ async def close_issue( async def to_issue_handler(self, issue_number: int): """获取议题处理器""" - from src.plugins.github.models.issue import IssueHandler + from src.plugins.github.handlers import IssueHandler issue = await self.get_issue(issue_number) diff --git a/src/plugins/github/models/issue.py b/src/plugins/github/handlers/issue.py similarity index 97% rename from src/plugins/github/models/issue.py rename to src/plugins/github/handlers/issue.py index c3d1f817..e9ecc528 100644 --- a/src/plugins/github/models/issue.py +++ b/src/plugins/github/handlers/issue.py @@ -4,7 +4,9 @@ from pydantic import ConfigDict from src.plugins.github.constants import SKIP_COMMENT -from src.plugins.github.models import AuthorInfo, GithubHandler +from src.plugins.github.models import AuthorInfo + +from .github import GithubHandler class IssueHandler(GithubHandler): diff --git a/src/plugins/github/models/__init__.py b/src/plugins/github/models.py similarity index 77% rename from src/plugins/github/models/__init__.py rename to src/plugins/github/models.py index 0a50be93..19029ca2 100644 --- a/src/plugins/github/models/__init__.py +++ b/src/plugins/github/models.py @@ -32,10 +32,3 @@ def from_issue(cls, issue: Issue) -> "AuthorInfo": author=issue.user.login if issue.user else "", author_id=issue.user.id if issue.user else 0, ) - - -from .git import GitHandler as GitHandler -from .github import GithubHandler as GithubHandler -from .issue import IssueHandler as IssueHandler - -__all__ = ["GitHandler", "GithubHandler", "IssueHandler", "RepoInfo", "AuthorInfo"] diff --git a/src/plugins/github/plugins/config/__init__.py b/src/plugins/github/plugins/config/__init__.py index ba70afc5..f71c8297 100644 --- a/src/plugins/github/plugins/config/__init__.py +++ b/src/plugins/github/plugins/config/__init__.py @@ -19,8 +19,7 @@ is_bot_triggered_workflow, is_config_workflow, ) -from src.plugins.github.models import IssueHandler -from src.plugins.github.models.github import GithubHandler +from src.plugins.github.handlers import GithubHandler, IssueHandler from src.plugins.github.plugins.publish.render import render_comment from src.plugins.github.plugins.publish.utils import ( ensure_issue_plugin_test_button, diff --git a/src/plugins/github/plugins/config/utils.py b/src/plugins/github/plugins/config/utils.py index a05bcd0a..08231963 100644 --- a/src/plugins/github/plugins/config/utils.py +++ b/src/plugins/github/plugins/config/utils.py @@ -2,8 +2,8 @@ from nonebot import logger +from src.plugins.github.handlers import IssueHandler from src.plugins.github.models import AuthorInfo -from src.plugins.github.models.issue import IssueHandler from src.plugins.github.plugins.publish.constants import ( PLUGIN_CONFIG_PATTERN, PLUGIN_MODULE_NAME_PATTERN, diff --git a/src/plugins/github/plugins/publish/__init__.py b/src/plugins/github/plugins/publish/__init__.py index 31687443..7702e7a1 100644 --- a/src/plugins/github/plugins/publish/__init__.py +++ b/src/plugins/github/plugins/publish/__init__.py @@ -28,7 +28,7 @@ is_bot_triggered_workflow, is_publish_workflow, ) -from src.plugins.github.models import GithubHandler, IssueHandler +from src.plugins.github.handlers import GithubHandler, IssueHandler from src.providers.validation.models import PublishType, ValidationDict from .depends import ( diff --git a/src/plugins/github/plugins/publish/utils.py b/src/plugins/github/plugins/publish/utils.py index f0116cf5..a8757b05 100644 --- a/src/plugins/github/plugins/publish/utils.py +++ b/src/plugins/github/plugins/publish/utils.py @@ -6,7 +6,7 @@ from src.plugins.github import plugin_config from src.plugins.github.constants import ISSUE_FIELD_PATTERN, ISSUE_FIELD_TEMPLATE from src.plugins.github.depends.utils import get_type_by_labels -from src.plugins.github.models import GithubHandler, IssueHandler +from src.plugins.github.handlers import GithubHandler, IssueHandler from src.plugins.github.typing import PullRequestList from src.plugins.github.utils import commit_message as _commit_message from src.providers.models import RegistryUpdatePayload, to_store diff --git a/src/plugins/github/plugins/publish/validation.py b/src/plugins/github/plugins/publish/validation.py index c7dce682..e65d5421 100644 --- a/src/plugins/github/plugins/publish/validation.py +++ b/src/plugins/github/plugins/publish/validation.py @@ -5,8 +5,8 @@ from nonebot import logger from src.plugins.github import plugin_config +from src.plugins.github.handlers import IssueHandler from src.plugins.github.models import AuthorInfo -from src.plugins.github.models.issue import IssueHandler from src.plugins.github.utils import extract_issue_info_from_issue from src.providers.docker_test import DockerPluginTest, Metadata from src.providers.utils import get_latest_version, load_json_from_file diff --git a/src/plugins/github/plugins/remove/__init__.py b/src/plugins/github/plugins/remove/__init__.py index bf70d3fa..d41a162c 100644 --- a/src/plugins/github/plugins/remove/__init__.py +++ b/src/plugins/github/plugins/remove/__init__.py @@ -22,8 +22,7 @@ is_bot_triggered_workflow, is_remove_workflow, ) -from src.plugins.github.models import IssueHandler -from src.plugins.github.models.github import GithubHandler +from src.plugins.github.handlers import GithubHandler, IssueHandler from src.plugins.github.typing import IssuesEvent from src.providers.validation.models import PublishType diff --git a/src/plugins/github/plugins/remove/utils.py b/src/plugins/github/plugins/remove/utils.py index a1883525..90a1c0d4 100644 --- a/src/plugins/github/plugins/remove/utils.py +++ b/src/plugins/github/plugins/remove/utils.py @@ -8,7 +8,7 @@ extract_issue_number_from_ref, get_type_by_labels, ) -from src.plugins.github.models import GithubHandler, IssueHandler +from src.plugins.github.handlers import GithubHandler, IssueHandler from src.plugins.github.typing import PullRequestList from src.plugins.github.utils import commit_message from src.providers.utils import dump_json5 diff --git a/src/plugins/github/plugins/resolve/__init__.py b/src/plugins/github/plugins/resolve/__init__.py index 83698d12..a409ddc4 100644 --- a/src/plugins/github/plugins/resolve/__init__.py +++ b/src/plugins/github/plugins/resolve/__init__.py @@ -10,8 +10,7 @@ get_related_issue_number, get_type_by_labels_name, ) -from src.plugins.github.models import IssueHandler -from src.plugins.github.models.github import GithubHandler +from src.plugins.github.handlers import GithubHandler, IssueHandler from src.plugins.github.plugins.publish.utils import ( resolve_conflict_pull_requests as resolve_conflict_publish_pull_requests, ) diff --git a/tests/plugins/github/publish/utils/test_comment_issue.py b/tests/plugins/github/publish/utils/test_comment_issue.py index ac95ed91..98c1e34b 100644 --- a/tests/plugins/github/publish/utils/test_comment_issue.py +++ b/tests/plugins/github/publish/utils/test_comment_issue.py @@ -5,7 +5,8 @@ async def test_comment_issue(app: App, mocker: MockerFixture): - from src.plugins.github.models import GithubHandler, RepoInfo + from src.plugins.github.handlers import GithubHandler + from src.plugins.github.models import RepoInfo render_comment = "test" @@ -40,7 +41,8 @@ async def test_comment_issue(app: App, mocker: MockerFixture): async def test_comment_issue_reuse(app: App, mocker: MockerFixture): from src.plugins.github.constants import NONEFLOW_MARKER - from src.plugins.github.models import GithubHandler, RepoInfo + from src.plugins.github.handlers import GithubHandler + from src.plugins.github.models import RepoInfo render_comment = "test" @@ -76,7 +78,8 @@ async def test_comment_issue_reuse(app: App, mocker: MockerFixture): async def test_comment_issue_reuse_same(app: App, mocker: MockerFixture): """测试评论内容相同时不会更新评论""" - from src.plugins.github.models import GithubHandler, RepoInfo + from src.plugins.github.handlers import GithubHandler + from src.plugins.github.models import RepoInfo render_comment = "test\n\n" diff --git a/tests/plugins/github/publish/utils/test_ensure_issue_content.py b/tests/plugins/github/publish/utils/test_ensure_issue_content.py index cc49e087..62fcfda8 100644 --- a/tests/plugins/github/publish/utils/test_ensure_issue_content.py +++ b/tests/plugins/github/publish/utils/test_ensure_issue_content.py @@ -7,7 +7,8 @@ async def test_ensure_issue_content(app: App, mocker: MockerFixture): """确保议题内容完整""" - from src.plugins.github.models import IssueHandler, RepoInfo + from src.plugins.github.handlers import IssueHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import ensure_issue_content async with app.test_api() as ctx: @@ -49,7 +50,8 @@ async def test_ensure_issue_content(app: App, mocker: MockerFixture): async def test_ensure_issue_content_partial(app: App, mocker: MockerFixture): """确保议题内容被补全""" - from src.plugins.github.models import IssueHandler, RepoInfo + from src.plugins.github.handlers import IssueHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import ensure_issue_content async with app.test_api() as ctx: @@ -78,7 +80,8 @@ async def test_ensure_issue_content_partial(app: App, mocker: MockerFixture): async def test_ensure_issue_content_complete(app: App, mocker: MockerFixture): """确保议题内容已经补全之后不会再次补全""" - from src.plugins.github.models import IssueHandler, RepoInfo + from src.plugins.github.handlers import IssueHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import ensure_issue_content async with app.test_api() as ctx: diff --git a/tests/plugins/github/publish/utils/test_ensure_issue_plugin_test_button.py b/tests/plugins/github/publish/utils/test_ensure_issue_plugin_test_button.py index 2874d847..653d4861 100644 --- a/tests/plugins/github/publish/utils/test_ensure_issue_plugin_test_button.py +++ b/tests/plugins/github/publish/utils/test_ensure_issue_plugin_test_button.py @@ -7,7 +7,8 @@ async def test_ensure_issue_plugin_test_button(app: App, mocker: MockerFixture): """确保添加插件测试按钮""" - from src.plugins.github.models import IssueHandler, RepoInfo + from src.plugins.github.handlers import IssueHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import ( ensure_issue_plugin_test_button, ) @@ -66,7 +67,8 @@ async def test_ensure_issue_plugin_test_button(app: App, mocker: MockerFixture): async def test_ensure_issue_plugin_test_button_checked(app: App, mocker: MockerFixture): """如果测试按钮勾选,则自动取消勾选""" - from src.plugins.github.models import IssueHandler, RepoInfo + from src.plugins.github.handlers import IssueHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import ( ensure_issue_plugin_test_button, ) @@ -127,7 +129,8 @@ async def test_ensure_issue_plugin_test_button_unchecked( app: App, mocker: MockerFixture ): """如果测试按钮未勾选,则不进行操作""" - from src.plugins.github.models import IssueHandler, RepoInfo + from src.plugins.github.handlers import IssueHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import ( ensure_issue_plugin_test_button, ) @@ -153,7 +156,8 @@ async def test_ensure_issue_plugin_test_button_in_progress( app: App, mocker: MockerFixture ): """确保添加插件测试按钮""" - from src.plugins.github.models import IssueHandler, RepoInfo + from src.plugins.github.handlers import IssueHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import ( ensure_issue_plugin_test_button_in_progress, ) diff --git a/tests/plugins/github/publish/utils/test_publish_resolve_conflict_pull_requests.py b/tests/plugins/github/publish/utils/test_publish_resolve_conflict_pull_requests.py index 7e3e292f..7d26aa16 100644 --- a/tests/plugins/github/publish/utils/test_publish_resolve_conflict_pull_requests.py +++ b/tests/plugins/github/publish/utils/test_publish_resolve_conflict_pull_requests.py @@ -28,7 +28,8 @@ async def test_resolve_conflict_pull_requests_adapter( app: App, mocker: MockerFixture, mocked_api: MockRouter, tmp_path: Path, mock_pull ) -> None: from src.plugins.github import plugin_config - from src.plugins.github.models import GithubHandler, RepoInfo + from src.plugins.github.handlers import GithubHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import resolve_conflict_pull_requests from src.providers.utils import dump_json5 @@ -158,7 +159,8 @@ async def test_resolve_conflict_pull_requests_bot( app: App, mocker: MockerFixture, mocked_api: MockRouter, tmp_path: Path, mock_pull ) -> None: from src.plugins.github import plugin_config - from src.plugins.github.models import GithubHandler, RepoInfo + from src.plugins.github.handlers import GithubHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import resolve_conflict_pull_requests from src.providers.utils import dump_json5 @@ -283,7 +285,8 @@ async def test_resolve_conflict_pull_requests_plugin( app: App, mocker: MockerFixture, mocked_api: MockRouter, tmp_path: Path, mock_pull ) -> None: from src.plugins.github import plugin_config - from src.plugins.github.models import GithubHandler, RepoInfo + from src.plugins.github.handlers import GithubHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import resolve_conflict_pull_requests from src.providers.docker_test import Metadata from src.providers.utils import dump_json5 @@ -432,7 +435,8 @@ async def test_resolve_conflict_pull_requests_plugin_not_valid( ) -> None: """测试插件信息不合法的情况""" from src.plugins.github import plugin_config - from src.plugins.github.models import GithubHandler, RepoInfo + from src.plugins.github.handlers import GithubHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import resolve_conflict_pull_requests from src.providers.utils import dump_json5 @@ -524,7 +528,8 @@ async def test_resolve_conflict_pull_requests_draft( app: App, mocker: MockerFixture, mocked_api: MockRouter, tmp_path: Path ) -> None: from src.plugins.github import plugin_config - from src.plugins.github.models import GithubHandler, RepoInfo + from src.plugins.github.handlers import GithubHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import resolve_conflict_pull_requests from src.providers.utils import dump_json5 @@ -586,7 +591,8 @@ async def test_resolve_conflict_pull_requests_ref( app: App, mocker: MockerFixture, mocked_api: MockRouter, tmp_path: Path ) -> None: from src.plugins.github import plugin_config - from src.plugins.github.models import GithubHandler, RepoInfo + from src.plugins.github.handlers import GithubHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import resolve_conflict_pull_requests from src.providers.utils import dump_json5 diff --git a/tests/plugins/github/publish/utils/test_trigger_registry_update.py b/tests/plugins/github/publish/utils/test_trigger_registry_update.py index aae8c933..ceeab838 100644 --- a/tests/plugins/github/publish/utils/test_trigger_registry_update.py +++ b/tests/plugins/github/publish/utils/test_trigger_registry_update.py @@ -14,7 +14,8 @@ async def test_trigger_registry_update( app: App, mocker: MockerFixture, mocked_api: MockRouter ): - from src.plugins.github.models import IssueHandler, RepoInfo + from src.plugins.github.handlers import IssueHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import trigger_registry_update from src.providers.docker_test import Metadata from src.providers.validation import PublishType @@ -126,7 +127,8 @@ async def test_trigger_registry_update_skip_test( app: App, mocker: MockerFixture, mocked_api: MockRouter ): """跳过插件加载测试的情况""" - from src.plugins.github.models import IssueHandler, RepoInfo + from src.plugins.github.handlers import IssueHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import trigger_registry_update from src.providers.validation import PublishType @@ -225,7 +227,8 @@ async def test_trigger_registry_update_bot( 已经有相同机器人的时候,registry_update 不会影响到机器人的测试 """ - from src.plugins.github.models import IssueHandler, RepoInfo + from src.plugins.github.handlers import IssueHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import trigger_registry_update from src.providers.validation import PublishType @@ -278,7 +281,8 @@ async def test_trigger_registry_update_plugins_issue_body_info_missing( """如果议题信息不全,应该不会触发更新""" from githubkit.rest import Issue - from src.plugins.github.models import IssueHandler, RepoInfo + from src.plugins.github.handlers import IssueHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import trigger_registry_update from src.providers.docker_test import Metadata from src.providers.validation import PublishType @@ -336,7 +340,8 @@ async def test_trigger_registry_update_validation_failed( app: App, mocker: MockerFixture, mocked_api: MockRouter ): """验证失败时也不会触发更新""" - from src.plugins.github.models import IssueHandler, RepoInfo + from src.plugins.github.handlers import IssueHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.publish.utils import trigger_registry_update from src.providers.validation import PublishType diff --git a/tests/plugins/github/publish/utils/test_validate_info_from_issue.py b/tests/plugins/github/publish/utils/test_validate_info_from_issue.py index 133d4ba3..ef35dbdf 100644 --- a/tests/plugins/github/publish/utils/test_validate_info_from_issue.py +++ b/tests/plugins/github/publish/utils/test_validate_info_from_issue.py @@ -51,8 +51,8 @@ async def test_validate_info_from_issue_plugin( app: App, mocker: MockerFixture, mocked_api: MockRouter ): from src.plugins.github import plugin_config + from src.plugins.github.handlers import IssueHandler from src.plugins.github.models import RepoInfo - from src.plugins.github.models.issue import IssueHandler from src.plugins.github.plugins.publish.validation import ( validate_plugin_info_from_issue, ) @@ -135,8 +135,8 @@ async def test_validate_info_from_issue_plugin_skip_test( app: App, mocker: MockerFixture, mocked_api: MockRouter ): """跳过插件测试的情况""" + from src.plugins.github.handlers import IssueHandler from src.plugins.github.models import RepoInfo - from src.plugins.github.models.issue import IssueHandler from src.plugins.github.plugins.publish.validation import ( validate_plugin_info_from_issue, ) diff --git a/tests/plugins/github/remove/utils/test_remove_resolve_pull_requests.py b/tests/plugins/github/remove/utils/test_remove_resolve_pull_requests.py index b6c87ac8..a19da1c0 100644 --- a/tests/plugins/github/remove/utils/test_remove_resolve_pull_requests.py +++ b/tests/plugins/github/remove/utils/test_remove_resolve_pull_requests.py @@ -37,7 +37,8 @@ async def test_resolve_conflict_pull_requests_bot( app: App, mocker: MockerFixture, mocked_api: MockRouter, tmp_path: Path, mock_pull ) -> None: from src.plugins.github import plugin_config - from src.plugins.github.models import GithubHandler, RepoInfo + from src.plugins.github.handlers import GithubHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.remove.utils import resolve_conflict_pull_requests from src.providers.utils import dump_json5 @@ -140,7 +141,8 @@ async def test_resolve_conflict_pull_requests_plugin( app: App, mocker: MockerFixture, mocked_api: MockRouter, tmp_path: Path, mock_pull ) -> None: from src.plugins.github import plugin_config - from src.plugins.github.models import GithubHandler, RepoInfo + from src.plugins.github.handlers import GithubHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.remove.utils import resolve_conflict_pull_requests from src.providers.utils import dump_json5 @@ -247,7 +249,8 @@ async def test_resolve_conflict_pull_requests_not_found( app: App, mocker: MockerFixture, mocked_api: MockRouter, tmp_path: Path, mock_pull ) -> None: from src.plugins.github import plugin_config - from src.plugins.github.models import GithubHandler, RepoInfo + from src.plugins.github.handlers import GithubHandler + from src.plugins.github.models import RepoInfo from src.plugins.github.plugins.remove.utils import resolve_conflict_pull_requests from src.providers.utils import dump_json5