def test_processing_error(): io = IO([Setup({}), Process("some data"), Stop()]) controller = Controller(handle_setup, error_handle_processing, io.send, io.recv) assert controller._state == "starting" controller.run() assert controller._state == "stopped" assert len(io.output) == 3
def test_controller_setup(): io = IO([Setup({}), Stop()]) controller = Controller(handle_setup, handle_processing, io.send, io.recv) assert controller._state == "starting" controller.run() assert controller._state == "stopped" assert len(io.output) == 3
def test_process_error(): res = r"boom" io = IO([Okay(), Okay(), Error(res)]) proxy = RunnerAdapterProxy(io.send, io.recv) proxy.setup({}) with pytest.raises(Exception, match=res): proxy.process("")
def test_process_success(): res = 0 io = IO([Okay(), Okay(), Results(res)]) proxy = RunnerAdapterProxy(io.send, io.recv) proxy.setup({}) result = proxy.process("") assert result == res assert len(io.output) == 2
def test_setup(): io = IO([Okay(), Okay()]) proxy = RunnerAdapterProxy(io.send, io.recv) proxy.setup({}) assert len(io.output) == 1