示例#1
0
 def _mock_for_start(
     self, service, init_deps=None, tasks=None, children=None, on_async_enter=None
 ):
     service.on_init_dependencies = Mock(return_value=init_deps or [])
     service.add_dependency = Mock()
     service.on_first_start = AsyncMock()
     service.exit_stack = ContextMock()
     service.async_exit_stack = AsyncContextManagerMock(
         side_effect=on_async_enter,
     )
     service.on_start = AsyncMock()
     service._get_tasks = Mock(return_value=tasks or [])
     service._children = children or []
示例#2
0
def current_execution_stack():
    with patch("faust.livecheck.case.current_execution_stack") as ces:
        ces.push = ContextMock()
        yield ces
示例#3
0
def current_test_stack():
    with patch("faust.livecheck.case.current_test_stack") as cts:
        cts.push = ContextMock()
        yield cts