message_ix_models.tests.model.test_bmt

Tests for the BMT workflow (Buildings, Materials, Transport).

Covers workflow steps and build functions in message_ix_models.model.bmt: - BM built / build_B (buildings), in model.buildings.build - BMTX built / build_PM (power sector materials), in model.bmt.utils

Coverage notes: - prepare_data_B and build_B: tested with and without materials

(with_materials=False and with_materials=True in test_prepare_data_B_*, test_build_B_runs_with_minimal_data, test_build_B_runs_with_materials).

  • utils: build_PM (test_build_PM_*), _generate_vetting_csv (test_generate_vetting_csv*).

  • CLI: bmt group and run subcommand (test_bmt_cli_help, test_bmt_run_dry_run).

Functions

bmt_context(test_context, tmp_path)

BMT context (R12) and buildings config with paths to minimal CSVs.

bmt_context_with_materials(bmt_context)

Like bmt_context but with with_materials=True for build_B materials path.

test_bmt_cli_help(mix_models_cli)

bmt and bmt run show --help.

test_bmt_run_dry_run(mix_models_cli)

bmt run --dry-run TARGET runs workflow in dry-run (writes SVG, no execution).

test_bmt_workflow_has_bm_built_step(test_context)

The BMT workflow includes the 'BM built' step that calls build_B.

test_bmt_workflow_has_bmtx_built_step(...)

The BMT workflow includes the 'BMTX built' step that calls build_PM.

test_build_PM_callable(test_context, request)

build_PM(context, scenario) runs; skip if scenario lacks inv_cost.

test_build_PM_returns_scenario(test_context, ...)

build_PM returns the scenario and skips when input_cap_new already has cement.

test_generate_vetting_csv(tmp_path)

_generate_vetting_csv writes CSV of original/modified demand and subtraction.

test_generate_vetting_csv_zero_original(tmp_path)

_generate_vetting_csv handles zero original demand (no div-by-zero).