|
@@ -137,3 +137,29 @@ def test_run_returns_when_pipe_is_true(mock_subprocess) -> None:
|
|
|
|
|
|
|
|
assert stdout == "Lorem Ipsum"
|
|
assert stdout == "Lorem Ipsum"
|
|
|
assert stderr == "Ooga Booga!"
|
|
assert stderr == "Ooga Booga!"
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def test_preamble_logs_input_and_output(ci_logger) -> None:
|
|
|
|
|
+ class PreambleAction(cipy.Action):
|
|
|
|
|
+ inputs: IPCInputAction.Inputs = IPCInputAction.Inputs(foo=1, bar="Hello")
|
|
|
|
|
+ outputs: IPCOutputAction.Outputs = IPCOutputAction.Outputs(
|
|
|
|
|
+ foo=5, bar="Lorem Ipsum"
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ @cipy.runner.preamble
|
|
|
|
|
+ def run(self, context: cipy.Context) -> cipy.Status:
|
|
|
|
|
+ return cipy.Status.SUCCESS
|
|
|
|
|
+
|
|
|
|
|
+ action = PreambleAction(name="Test")
|
|
|
|
|
+ action.run(cipy.Context())
|
|
|
|
|
+
|
|
|
|
|
+ ci_logger.format.assert_has_calls(
|
|
|
|
|
+ [
|
|
|
|
|
+ call(HasAttributes(levelno=logging.INFO, message="with:")),
|
|
|
|
|
+ call(HasAttributes(levelno=logging.INFO, args=("foo", 1))),
|
|
|
|
|
+ call(HasAttributes(levelno=logging.INFO, args=("bar", "Hello"))),
|
|
|
|
|
+ call(HasAttributes(levelno=logging.DEBUG, message="outputs:")),
|
|
|
|
|
+ call(HasAttributes(levelno=logging.DEBUG, args=("foo", 5))),
|
|
|
|
|
+ call(HasAttributes(levelno=logging.DEBUG, args=("bar", "Lorem Ipsum"))),
|
|
|
|
|
+ ]
|
|
|
|
|
+ )
|