@@ -229,20 +229,7 @@ def test_multiple_construction_years(self):
229229 logs , 'has been adjusted to: [0.25, 0.25, 0.25, 0.25]' , treat_substring_match_as_match = True
230230 )
231231 except AssertionError as ae :
232- # if sys.version_info < (3, 9):
233- if self ._is_github_actions ():
234- # FIXME - see
235- # https://github.com/softwareengineerprogrammer/GEOPHIRES/actions/runs/19646240874/job/56262028512#step:5:344
236- _log .warning (
237- f'WARNING: Skipping assertion in GitHub Actions '
238- f'for Python { sys .version_info .major } .{ sys .version_info .minor } '
239- )
240-
241- # self.assertHasLogRecordWithMessage(
242- # logs, 'has been adjusted to:', treat_substring_match_as_match=True
243- # )
244- else :
245- raise ae
232+ self ._handle_assert_logs_failure (ae )
246233
247234 cy4_cf = construction_years_4 .result ['SAM CASH FLOW PROFILE' ]
248235
@@ -310,15 +297,15 @@ def _sched(sched: list[float]) -> listParameter:
310297 half_half = [0.5 , 0.5 ]
311298 self .assertListEqual (half_half , _validate_construction_capex_schedule (_sched (half_half ), 2 , model_logger ))
312299
313- with self .assertLogs (level = 'WARNING' ) as logs :
300+ with self .assertLogs (logger = model_logger . name , level = 'WARNING' ) as logs :
314301 quarters = [0.25 ] * 4
315302 self .assertListEqual (half_half , _validate_construction_capex_schedule (_sched (quarters ), 2 , model_logger ))
316303 self .assertHasLogRecordWithMessage (
317304 logs , 'has been adjusted to: [0.5, 0.5]' , treat_substring_match_as_match = True
318305 )
319306
320- double_ones = [ 1.0 , 1.0 ]
321- with self . assertLogs ( level = 'WARNING' ) as logs2 :
307+ with self . assertLogs ( logger = model_logger . name , level = 'WARNING' ) as logs2 :
308+ double_ones = [ 1.0 , 1.0 ]
322309 self .assertListEqual (half_half , _validate_construction_capex_schedule (_sched (double_ones ), 2 , model_logger ))
323310 self .assertHasLogRecordWithMessage (logs2 , 'does not sum to 1.0' , treat_substring_match_as_match = True )
324311
@@ -884,3 +871,15 @@ def _new_model(input_file: Path, additional_params: dict[str, Any] | None = None
884871 m .Calculate ()
885872
886873 return m
874+
875+ def _handle_assert_logs_failure (self , ae : AssertionError ):
876+ # if sys.version_info < (3, 9):
877+ if self ._is_github_actions ():
878+ # FIXME - see
879+ # https://github.com/softwareengineerprogrammer/GEOPHIRES/actions/runs/19646240874/job/56262028512#step:5:344
880+ _log .warning (
881+ f'WARNING: Skipping assertion in GitHub Actions '
882+ f'for Python { sys .version_info .major } .{ sys .version_info .minor } '
883+ )
884+ else :
885+ raise ae
0 commit comments