-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: github actions 상에서의 test ci 실패 원인 파악 중
- Loading branch information
Showing
2 changed files
with
22 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
from time import sleep | ||
from asyncio import sleep as asleep | ||
|
||
import pytest | ||
from spakky.application.application_context import ApplicationContext | ||
from spakky.domain.ports.event.event_publisher import ( | ||
IAsyncEventPublisher, | ||
IEventPublisher, | ||
) | ||
from spakky.threading.managed_thread import AsyncManagedThread, ManagedThread | ||
|
||
from tests.apps.dummy import DummyEventHandler, SampleEvent | ||
|
||
|
||
def test_synchronous_event_publish_and_consume( | ||
context: ApplicationContext, managed_thread: ManagedThread | ||
) -> None: | ||
managed_thread.start() | ||
def test_synchronous_event_publish_and_consume(context: ApplicationContext) -> None: | ||
publisher = context.get(IEventPublisher) | ||
publisher.publish(SampleEvent(message="Hello, World!")) | ||
publisher.publish(SampleEvent(message="Goodbye, World!")) | ||
sleep(0.1) | ||
handler = context.get(DummyEventHandler) | ||
assert handler.count == 2 | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_asynchronous_event_publish_and_consume( | ||
context: ApplicationContext, async_managed_thread: AsyncManagedThread | ||
context: ApplicationContext, | ||
) -> None: | ||
async_managed_thread.start() | ||
publisher = context.get(IAsyncEventPublisher) | ||
await publisher.publish(SampleEvent(message="Hello, World!")) | ||
await publisher.publish(SampleEvent(message="Goodbye, World!")) | ||
await asleep(0.1) | ||
handler = context.get(DummyEventHandler) | ||
assert handler.count == 2 |