Skip to content

Commit 448463c

Browse files
try scoping skip to py38 (again)
1 parent c4c27d5 commit 448463c

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

tests/geophires_x_tests/test_economics_sam.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -297,17 +297,27 @@ def _sched(sched: list[float]) -> listParameter:
297297
half_half = [0.5, 0.5]
298298
self.assertListEqual(half_half, _validate_construction_capex_schedule(_sched(half_half), 2, model_logger))
299299

300-
with self.assertLogs(logger=model_logger.name, level='WARNING') as logs:
301-
quarters = [0.25] * 4
302-
self.assertListEqual(half_half, _validate_construction_capex_schedule(_sched(quarters), 2, model_logger))
303-
self.assertHasLogRecordWithMessage(
304-
logs, 'has been adjusted to: [0.5, 0.5]', treat_substring_match_as_match=True
305-
)
300+
try:
301+
with self.assertLogs(logger=model_logger.name, level='WARNING') as logs:
302+
quarters = [0.25] * 4
303+
self.assertListEqual(
304+
half_half, _validate_construction_capex_schedule(_sched(quarters), 2, model_logger)
305+
)
306+
self.assertHasLogRecordWithMessage(
307+
logs, 'has been adjusted to: [0.5, 0.5]', treat_substring_match_as_match=True
308+
)
309+
except AssertionError as ae:
310+
self._handle_assert_logs_failure(ae)
306311

307-
with self.assertLogs(logger=model_logger.name, level='WARNING') as logs2:
308-
double_ones = [1.0, 1.0]
309-
self.assertListEqual(half_half, _validate_construction_capex_schedule(_sched(double_ones), 2, model_logger))
310-
self.assertHasLogRecordWithMessage(logs2, 'does not sum to 1.0', treat_substring_match_as_match=True)
312+
try:
313+
with self.assertLogs(logger=model_logger.name, level='WARNING') as logs2:
314+
double_ones = [1.0, 1.0]
315+
self.assertListEqual(
316+
half_half, _validate_construction_capex_schedule(_sched(double_ones), 2, model_logger)
317+
)
318+
self.assertHasLogRecordWithMessage(logs2, 'does not sum to 1.0', treat_substring_match_as_match=True)
319+
except AssertionError as ae:
320+
self._handle_assert_logs_failure(ae)
311321

312322
def assertAlmostEqualWithinSigFigs(self, expected: float | int, actual: float | int, num_sig_figs: int = 3):
313323
"""
@@ -873,12 +883,11 @@ def _new_model(input_file: Path, additional_params: dict[str, Any] | None = None
873883
return m
874884

875885
def _handle_assert_logs_failure(self, ae: AssertionError):
876-
# if sys.version_info < (3, 9):
877-
if self._is_github_actions():
886+
if sys.version_info[:2] == (3, 8) and self._is_github_actions():
878887
# FIXME - see
879888
# https://github.com/softwareengineerprogrammer/GEOPHIRES/actions/runs/19646240874/job/56262028512#step:5:344
880889
_log.warning(
881-
f'WARNING: Skipping assertion in GitHub Actions '
890+
f'WARNING: Skipping logs assertion in GitHub Actions '
882891
f'for Python {sys.version_info.major}.{sys.version_info.minor}'
883892
)
884893
else:

0 commit comments

Comments
 (0)