Skip to content

Commit 55f8032

Browse files
committed
test: make sure pytest exits completely after running async tests
1 parent 607c2a2 commit 55f8032

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## Upcoming
4+
5+
- test: make sure pytest exits completely after running async tests
6+
37
## Version 0.21.1
48

59
- refactor: add `WithState` class to be the return value of the `store.with_state` so that it can report correct signature of its `__call__` method

tests/test_async.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
from redux.main import Store
2424

2525
if TYPE_CHECKING:
26-
from collections.abc import Generator
27-
2826
from redux_pytest.fixtures.event_loop import LoopThread
2927

3028
INCREMENTS = 20
@@ -70,16 +68,15 @@ def reducer(
7068

7169

7270
@pytest.fixture
73-
def store(event_loop: LoopThread) -> Generator[StoreType, None, None]:
74-
store = Store(
71+
def store(event_loop: LoopThread) -> StoreType:
72+
return Store(
7573
reducer,
7674
options=CreateStoreOptions(
7775
auto_init=True,
7876
task_creator=event_loop.create_task,
77+
on_finish=event_loop.stop,
7978
),
8079
)
81-
yield store
82-
store.subscribe_event(FinishEvent, lambda: event_loop.stop())
8380

8481

8582
def dispatch_actions(store: StoreType) -> None:

0 commit comments

Comments
 (0)