diff --git a/pilot/prompts/__init__.py b/pilot/prompts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pilot/prompts/dev_ops/ran_command.prompt b/pilot/prompts/dev_ops/ran_command.prompt index a586686..5617503 100644 --- a/pilot/prompts/dev_ops/ran_command.prompt +++ b/pilot/prompts/dev_ops/ran_command.prompt @@ -1,8 +1,6 @@ {{ additional_info }}I ran the command `{{ command }}` -{%- if exit_code %}, the exit code was {{ exit_code }} {% endif -%} -and the output was: -``` -{{ cli_response }} -``` +{%- if exit_code is number %}, the exit code was {{ exit_code }}{% endif %} and the output was: -If the command was successfully executed, respond with `DONE` and if it wasn't, respond with `NEEDS_DEBUGGING`. +{{ cli_response }} + +If the command was successfully executed, respond with `DONE`. If it wasn't, respond with `NEEDS_DEBUGGING` and single line explanation. diff --git a/pilot/prompts/test_prompts.py b/pilot/prompts/test_prompts.py new file mode 100644 index 0000000..b71c03f --- /dev/null +++ b/pilot/prompts/test_prompts.py @@ -0,0 +1,45 @@ +from .prompts import get_prompt + + +def test_prompt_ran_command_None_exit(): + # When + prompt = get_prompt('dev_ops/ran_command.prompt', { + 'cli_response': 'stdout:\n```\nsuccess\n```', + 'command': './scripts/run_tests', + 'additional_message': 'Some additional message\n', + 'exit_code': None + }) + + # Then + assert prompt == ''' +I ran the command `./scripts/run_tests` and the output was: + +stdout: +``` +success +``` + +If the command was successfully executed, respond with `DONE`. If it wasn't, respond with `NEEDS_DEBUGGING` and single line explanation. +'''.strip() + + +def test_prompt_ran_command_0_exit(): + # When + prompt = get_prompt('dev_ops/ran_command.prompt', { + 'cli_response': 'stdout:\n```\nsuccess\n```', + 'command': './scripts/run_tests', + 'additional_message': 'Some additional message\n', + 'exit_code': 0 + }) + + # Then + assert prompt == ''' +I ran the command `./scripts/run_tests`, the exit code was 0 and the output was: + +stdout: +``` +success +``` + +If the command was successfully executed, respond with `DONE`. If it wasn't, respond with `NEEDS_DEBUGGING` and single line explanation. +'''.strip()