@@ -123,7 +123,7 @@ def get_prompt(
123123 readme_file :pathlib .Path ,
124124 explanation_in :str ,
125125 ) -> str :
126- pytest_longrepr_list = collect_longrepr_from_multiple_reports (report_paths )
126+ pytest_longrepr_list = collect_longrepr_from_multiple_reports (report_paths , explanation_in )
127127
128128 def get_initial_instruction (questions :List [str ],language :str ) -> str :
129129 # Add the main directive or instruction based on whether there are failed tests
@@ -139,11 +139,10 @@ def get_initial_instruction(questions:List[str],language:str) -> str:
139139
140140 prompt_list = (
141141 # Add the initial instruction
142- [get_initial_instruction (pytest_longrepr_list , explanation_in ), get_report_header ( explanation_in ) ]
142+ [get_initial_instruction (pytest_longrepr_list , explanation_in ),]
143143 + pytest_longrepr_list
144144 # Add the code and instructions
145145 + [
146- get_report_footer (explanation_in ),
147146 get_student_code_block (student_files , explanation_in ,),
148147 get_instruction_block (readme_file , explanation_in ,)
149148 ]
@@ -155,7 +154,7 @@ def get_initial_instruction(questions:List[str],language:str) -> str:
155154 return prompt_str
156155
157156
158- def collect_longrepr_from_multiple_reports (pytest_json_report_paths :Tuple [pathlib .Path ]) -> List [str ]:
157+ def collect_longrepr_from_multiple_reports (pytest_json_report_paths :Tuple [pathlib .Path ], explanation_in : str ) -> List [str ]:
159158 questions = []
160159
161160 # Process each report file
@@ -167,6 +166,10 @@ def collect_longrepr_from_multiple_reports(pytest_json_report_paths:Tuple[pathli
167166
168167 questions += longrepr_list
169168
169+ if questions :
170+ questions .insert (0 , get_report_header (explanation_in ))
171+ questions .append (get_report_footer (explanation_in ))
172+
170173 return questions
171174
172175
0 commit comments