Skip to content

Commit

Permalink
Adjust test_reporter.test_configure()
Browse files Browse the repository at this point in the history
Use protect_rename_dims fixture.
  • Loading branch information
khaeru committed Nov 17, 2023
1 parent b2a9bc8 commit cc0d667
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions ixmp/tests/report/test_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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'
Expand All @@ -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)
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit cc0d667

Please sign in to comment.