This repository was archived by the owner on Jan 28, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed
tests/test_networks/test_scheduling Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ class Command(DeclarativeModel):
2929
3030 topic : str
3131 data : Any
32- saga : UUID
32+ saga : Optional [ UUID ]
3333 reply_topic : str
3434 user : Optional [UUID ]
3535
@@ -39,7 +39,7 @@ class CommandReply(DeclarativeModel):
3939
4040 topic : str
4141 data : Any
42- saga : UUID
42+ saga : Optional [ UUID ]
4343 status : CommandStatus
4444 service_name : Optional [str ]
4545
Original file line number Diff line number Diff line change 33import warnings
44from unittest .mock import (
55 AsyncMock ,
6+ MagicMock ,
67 call ,
78 patch ,
89)
@@ -87,15 +88,15 @@ def test_fn(self) -> None:
8788
8889 async def test_start (self ) -> None :
8990 self .assertFalse (self .periodic .started )
91+ run_mock = MagicMock ()
92+ self .periodic .run_forever = run_mock
9093
91- with patch ("asyncio.create_task" , return_value = "test" ) as mock_create :
92- with warnings .catch_warnings ():
93- warnings .simplefilter ("ignore" , RuntimeWarning )
94- await self .periodic .start ()
95- self .assertEqual (1 , mock_create .call_count )
96- self .assertEqual ("run_forever" , mock_create .call_args .args [0 ].__name__ )
97- self .assertTrue (self .periodic .started )
98- self .assertEqual ("test" , self .periodic .task )
94+ with patch ("asyncio.create_task" , return_value = "test" ):
95+ await self .periodic .start ()
96+
97+ self .assertTrue (self .periodic .started )
98+ self .assertEqual ("test" , self .periodic .task )
99+ self .assertEqual (1 , run_mock .call_count )
99100
100101 async def test_stop (self ) -> None :
101102 mock = AsyncMock ()
You can’t perform that action at this time.
0 commit comments