Skip to content

Commit

Permalink
test: 修复没有正确 mock 导致 Actions 运行测试时会输出作业摘要的问题 (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
he0119 authored Dec 12, 2024
1 parent af27dd4 commit 18164bf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def load_plugin(nonebug_init: None) -> set["Plugin"]:


@pytest.fixture
async def app(app: App, tmp_path: Path, mocker: MockerFixture):
async def app(
app: App, tmp_path: Path, mocker: MockerFixture, monkeypatch: pytest.MonkeyPatch
):
from src.plugins.github import plugin_config
from src.providers.utils import dump_json5

Expand Down Expand Up @@ -98,6 +100,9 @@ async def app(app: App, tmp_path: Path, mocker: MockerFixture):
mocker.patch.object(
plugin_config, "github_step_summary", tmp_path / "step_summary.txt"
)
# NOTE: 由于 providers 中没有初始化 nonebot,所以不能使用插件中的配置,只能直接使用环境变量。
# 以后需要想想办法,如果能通过 nb-cli 启动就好了。
monkeypatch.setenv("GITHUB_STEP_SUMMARY", str(tmp_path / "step_summary.md"))

yield app

Expand Down

0 comments on commit 18164bf

Please sign in to comment.