Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: 修复没有正确 mock 导致 Actions 运行测试时会输出作业摘要的问题 #322

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading