Skip to content

Commit

Permalink
test: 修复测试
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 committed Dec 8, 2024
1 parent 2d8485b commit 39f67f1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions tests/providers/docker_test/test_docker_plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ async def test_docker_plugin_test(mocked_api: MockRouter, mocker: MockerFixture)

assert not mocked_api["store_plugins"].called
mocked_run.assert_called_once_with(
"ghcr.io/nonebot/nonetest:3.12-latest",
"ghcr.io/nonebot/nonetest:latest",
environment=snapshot(
{
"PROJECT_LINK": "project_link",
"MODULE_NAME": "module_name",
"PLUGIN_CONFIG": "",
"PLUGINS_URL": "https://raw.githubusercontent.com/nonebot/registry/results/plugins.json",
"PYTHON_VERSION": "3.12",
}
),
detach=False,
Expand Down Expand Up @@ -83,13 +84,14 @@ async def test_docker_plugin_test_exception(

assert not mocked_api["store_plugins"].called
mocked_run.assert_called_once_with(
"ghcr.io/nonebot/nonetest:3.12-latest",
"ghcr.io/nonebot/nonetest:latest",
environment=snapshot(
{
"PROJECT_LINK": "project_link",
"MODULE_NAME": "module_name",
"PLUGIN_CONFIG": "",
"PLUGINS_URL": "https://raw.githubusercontent.com/nonebot/registry/results/plugins.json",
"PYTHON_VERSION": "3.12",
}
),
detach=False,
Expand Down Expand Up @@ -149,13 +151,14 @@ async def test_docker_plugin_test_metadata_some_fields_empty(

assert not mocked_api["store_plugins"].called
mocked_run.assert_called_once_with(
"ghcr.io/nonebot/nonetest:3.12-latest",
"ghcr.io/nonebot/nonetest:latest",
environment=snapshot(
{
"PROJECT_LINK": "project_link",
"MODULE_NAME": "module_name",
"PLUGIN_CONFIG": "",
"PLUGINS_URL": "https://raw.githubusercontent.com/nonebot/registry/results/plugins.json",
"PYTHON_VERSION": "3.12",
}
),
detach=False,
Expand Down Expand Up @@ -215,13 +218,14 @@ async def test_docker_plugin_test_metadata_some_fields_invalid(

assert not mocked_api["store_plugins"].called
mocked_run.assert_called_once_with(
"ghcr.io/nonebot/nonetest:3.12-latest",
"ghcr.io/nonebot/nonetest:latest",
environment=snapshot(
{
"PROJECT_LINK": "project_link",
"MODULE_NAME": "module_name",
"PLUGIN_CONFIG": "",
"PLUGINS_URL": "https://raw.githubusercontent.com/nonebot/registry/results/plugins.json",
"PYTHON_VERSION": "3.12",
}
),
detach=False,
Expand Down
4 changes: 2 additions & 2 deletions tests/providers/docker_test/test_plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
async def test_plugin_test(mocker: MockerFixture, tmp_path: Path):
from src.providers.docker_test.plugin_test import PluginTest

test = PluginTest("project_link", "module_name", "test=123")
test = PluginTest("3.12", "project_link", "module_name", "test=123")

mocker.patch.object(test, "_test_dir", tmp_path / "plugin_test")

def command_output(cmd: str, timeout: int = 300):
if (
cmd
== r"""poetry init -n && sed -i "s/\^/~/g" pyproject.toml && poetry env info --ansi && poetry add project_link"""
== r"""uv venv --python 3.12 && poetry init -n --python "~3.12" && poetry env info --ansi && poetry add project_link"""
):
# create_poetry_project
return (
Expand Down

0 comments on commit 39f67f1

Please sign in to comment.