1616# test_examples_run.py runs the examples and compares the results
1717# to the expected results in tests/results/examples
1818
19- UPDATE_RESULTS = True
19+ UPDATE_RESULTS = False
2020RESULTS_VERSION = 1
2121OLLAMA_GHACTIONS_RESULTS_ENV_VAR = os .getenv ("OLLAMA_GHACTIONS_RESULTS" , "" )
2222OLLAMA_GHACTIONS_RESULTS = False
@@ -191,28 +191,34 @@ def test_valid_programs(capsys: CaptureFixture[str], monkeypatch: MonkeyPatch) -
191191 output = "all" ,
192192 config = pdl .InterpreterConfig (batch = 0 ),
193193 )
194- result = output ["result" ]
194+ actual_result = output ["result" ]
195195
196196 block_to_dict (output ["trace" ], json_compatible = True )
197197 result_dir_name = (
198198 pathlib .Path ("." ) / "tests" / "results" / pdl_file_name .parent
199199 )
200200
201- if not __find_and_compare_results (pdl_file_name , str (result )):
201+ if not __find_and_compare_results (pdl_file_name , str (actual_result )):
202202
203203 if OLLAMA_GHACTIONS_RESULTS :
204204 print (
205- "-------------------- Updating result from running Ollama on GitHub Actions -------------------- "
205+ f"Program { str ( pdl_file_name ) } requries updating its result on GitHub Actions"
206206 )
207+ print (f"Actual results: { str (actual_result )} " )
207208 result_file_name = f"{ pdl_file_name .stem } .ollama_ghactions.result"
208209 __write_to_results_file (
209- result_dir_name , result_file_name , str (result )
210+ result_dir_name , result_file_name , str (actual_result )
210211 )
211212
212213 # Evaluate the results again. If fails again, then consider this program as failing
213- if not __find_and_compare_results (pdl_file_name , str (result )):
214+ if not __find_and_compare_results (
215+ pdl_file_name , str (actual_result )
216+ ):
217+ print (
218+ f"Program { str (pdl_file_name )} failed second time even after generating results from Github Actions. Consider this failing!"
219+ )
214220 wrong_results [str (pdl_file_name )] = {
215- "actual" : str (result ),
221+ "actual" : str (actual_result ),
216222 }
217223 # If evaluating results produces correct result, then this is considered passing
218224 else :
@@ -223,11 +229,11 @@ def test_valid_programs(capsys: CaptureFixture[str], monkeypatch: MonkeyPatch) -
223229 f"{ pdl_file_name .stem } .{ str (RESULTS_VERSION )} .result"
224230 )
225231 __write_to_results_file (
226- result_dir_name , result_file_name , str (result )
232+ result_dir_name , result_file_name , str (actual_result )
227233 )
228234
229235 wrong_results [str (pdl_file_name )] = {
230- "actual" : str (result ),
236+ "actual" : str (actual_result ),
231237 }
232238 except PDLParseError :
233239 actual_parse_error |= {str (pdl_file_name )}
0 commit comments