Skip to content

Commit

Permalink
TEMPORARY Debug test_plot_simulated on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
khaeru committed Jan 30, 2025
1 parent 4c205a6 commit f99a4c9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ jobs:
run: |
pytest message_ix_models \
-m "not (ece_db or snapshot)" \
--color=yes --durations=20 -rA --verbose \
--color=yes --durations=20 -rA --verbose --exitfirst \
--cov-report=term-missing --cov-report=xml \
--numprocesses=auto \
--local-cache --jvmargs="-Xmx6G"
Expand Down
3 changes: 3 additions & 0 deletions message_ix_models/model/transport/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,15 @@ def from_context(
# Handle arguments
options = options or dict()

log.debug(f".transport.Config.from_context: {context.model.regions = }")
try:
# Identify the node codelist used in `scenario`
regions = identify_nodes(scenario) if scenario else context.model.regions
except (AttributeError, ValueError):
pass
else:
if scenario:
log.debug(f".transport.Config.from_context: {scenario.set('node') = }")
if context.model.regions != regions:
log.info(
f"Override Context.model.regions={context.model.regions!r} with "
Expand Down
4 changes: 4 additions & 0 deletions message_ix_models/model/transport/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ def simulated_solution(request, context) -> Reporter:
from .report import callback

# Build the base model
log.debug(f"simulated_solution: {context.regions = }")
scenario = built_transport(request, context, solved=False)
log.debug(f"simulated_solution: {scenario.set('node') = }")

# Info about the built model
info = ScenarioInfo(scenario)
Expand Down Expand Up @@ -194,4 +196,6 @@ def simulated_solution(request, context) -> Reporter:
with silence_log("genno", logging.CRITICAL):
message_ix_models.report.prepare_reporter(context, reporter=rep)

log.debug(f"simulated_solution: {context.regions = }")

return rep
2 changes: 2 additions & 0 deletions message_ix_models/report/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ def prepare_reporter(
"""
log.info("Prepare reporter")

log.debug(f".report.prepare_reporter: {context.regions = }")

if reporter:
# Existing `Reporter` provided
rep = reporter
Expand Down
1 change: 1 addition & 0 deletions message_ix_models/tests/model/transport/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def test_simulated_solution(request, test_context, regions="R12", years="B"):
def test_plot_simulated(request, test_context, plot_name, regions="R12", years="B"):
"""Plots are generated correctly using simulated data."""
test_context.update(regions=regions, years=years)
log.debug(f"test_plot_simulated: {test_context.regions = }")
rep = simulated_solution(request, test_context)

# print(rep.describe(f"plot {plot_name}")) # DEBUG
Expand Down

0 comments on commit f99a4c9

Please sign in to comment.