From cc0d667182b14c43e55c486d7325a20b01fb75d0 Mon Sep 17 00:00:00 2001 From: Paul Natsuo Kishimoto Date: Fri, 17 Nov 2023 11:40:49 +0100 Subject: [PATCH] Adjust test_reporter.test_configure() Use protect_rename_dims fixture. --- ixmp/tests/report/test_reporter.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ixmp/tests/report/test_reporter.py b/ixmp/tests/report/test_reporter.py index 7685c1395..afd801867 100644 --- a/ixmp/tests/report/test_reporter.py +++ b/ixmp/tests/report/test_reporter.py @@ -7,7 +7,6 @@ import ixmp from ixmp.report.reporter import Reporter -from ixmp.report.util import RENAME_DIMS from ixmp.testing import add_test_data, assert_logs, make_dantzig pytestmark = pytest.mark.usefixtures("parametrize_quantity_class") @@ -23,8 +22,9 @@ def scenario(test_mp): yield scen +@pytest.mark.usefixtures("protect_rename_dims") def test_configure(test_mp, test_data_path): - # Configure globally; reads 'rename_dims' section + # Configure globally; handles 'rename_dims' section configure(rename_dims={"i": "i_renamed"}) # Reporting uses the RENAME_DIMS mapping of 'i' to 'i_renamed' @@ -37,9 +37,6 @@ def test_configure(test_mp, test_data_path): assert "d:i-j" not in rep, rep.graph.keys() pytest.raises(KeyError, rep.get, "i") - # Remove the configuration for renaming 'i', so that other tests work - RENAME_DIMS.pop("i") - def test_reporter_from_scenario(scenario): r = Reporter.from_scenario(scenario) @@ -180,9 +177,9 @@ def test_cli(ixmp_cli, test_mp, test_data_path): seattle chicago 1\.7 new-york 2\.5 topeka 1\.8 -(Name: value, )?dtype: float64(, units: dimensionsless)?""", +(Name: value, )?dtype: float64(, units: dimensionless)?""", result.output, - ) + ), result.output def test_filters(test_mp, tmp_path, caplog):