def test_plan( self, async_used: bool, caplog: LogCaptureFixture, fx_deployments: YamlLoaderDeployment, mocker: MockerFixture, runway_context: MockRunwayContext, ) -> None: """Test plan.""" caplog.set_level(logging.INFO, logger="runway") mock_async = mocker.patch.object(Module, "_Module__async") mock_sync = mocker.patch.object(Module, "_Module__sync") mocker.patch.object(Module, "use_async", async_used) mod = Module( context=runway_context, definition=fx_deployments.load( "simple_parallel_module").modules[0], ) assert mod.plan() if async_used: assert ("parallel_parent:processing of modules will be done in " "parallel during deploy/destroy" in caplog.messages) mock_async.assert_not_called() mock_sync.assert_called_once_with("plan")
def test_plan_no_children(self, async_used, caplog, fx_deployments, monkeypatch, runway_context): """Test plan with no child modules.""" caplog.set_level(logging.INFO, logger="runway") mock_async = MagicMock() monkeypatch.setattr(Module, "_Module__async", mock_async) mock_sync = MagicMock() monkeypatch.setattr(Module, "_Module__sync", mock_sync) mock_run = MagicMock() monkeypatch.setattr(Module, "run", mock_run) monkeypatch.setattr(Module, "use_async", async_used) mod = Module( context=runway_context, definition=fx_deployments.load("min_required").modules[0], ) assert mod.plan() mock_run.assert_called_once_with("plan") mock_async.assert_not_called() mock_sync.assert_not_called()
def test_plan(self, async_used, caplog, fx_deployments, monkeypatch, runway_context): """Test plan.""" caplog.set_level(logging.INFO, logger="runway") mock_async = MagicMock() monkeypatch.setattr(Module, "_Module__async", mock_async) mock_sync = MagicMock() monkeypatch.setattr(Module, "_Module__sync", mock_sync) monkeypatch.setattr(Module, "use_async", async_used) mod = Module( context=runway_context, definition=fx_deployments.load( "simple_parallel_module").modules[0], ) assert mod.plan() if async_used: assert ("parallel_parent:processing of modules will be done in " "parallel during deploy/destroy" in caplog.messages) mock_async.assert_not_called() mock_sync.assert_called_once_with("plan")
def test_plan_no_children( self, async_used: bool, caplog: LogCaptureFixture, fx_deployments: YamlLoaderDeployment, mocker: MockerFixture, runway_context: MockRunwayContext, ) -> None: """Test plan with no child modules.""" caplog.set_level(logging.INFO, logger="runway") mock_async = mocker.patch.object(Module, "_Module__async") mock_sync = mocker.patch.object(Module, "_Module__sync") mock_run = mocker.patch.object(Module, "run") mocker.patch.object(Module, "use_async", async_used) mod = Module( context=runway_context, definition=fx_deployments.load("min_required").modules[0], ) assert mod.plan() mock_run.assert_called_once_with("plan") mock_async.assert_not_called() mock_sync.assert_not_called()