Files
2026-07-13 12:45:58 +08:00

26 lines
788 B
Python

"""Shared pytest fixtures.
`fake_slack` boots the in-process FakeSlack harness on an ephemeral port and points the Slack
adapter at it via `SLACK_API_URL`, so the real `SlackAdapter` / `slack_bolt` stack runs
end-to-end with no network, tokens, or the Slack app console. See
`coworker.testing.fake_slack` and `platform/docs/FAKE-SLACK-SPEC.md`.
"""
from __future__ import annotations
import pytest_asyncio
from coworker.testing.fake_slack import FakeSlack
@pytest_asyncio.fixture
async def fake_slack(monkeypatch):
"""A running FakeSlack control object; `SLACK_API_URL` is set to it for the test's duration."""
fake = FakeSlack()
await fake.start()
monkeypatch.setenv("SLACK_API_URL", fake.api_url)
try:
yield fake
finally:
await fake.stop()