Skip to content

Commit

Permalink
Merge pull request #307 from iiasa/post-2.0-cleanup
Browse files Browse the repository at this point in the history
Adjust to v2.0 deprecations in ixmp
  • Loading branch information
khaeru authored Feb 11, 2020
2 parents c72f6aa + 5b3b503 commit 45e630c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
2 changes: 2 additions & 0 deletions RELEASE_NOTES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Next release
All changes
-----------

- `#307 <https://github.com/iiasa/message_ix/pull/307>`_: adjust to deprecations in ixmp 2.0.


v2.0.0 (2020-01-14)
===================
Expand Down
2 changes: 1 addition & 1 deletion ci/pip-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Always track ixmp master
git+git://github.com/iiasa/ixmp.git#egg=ixmp
git+git://github.com/iiasa/ixmp.git@master#egg=ixmp

# pyam-iamc
# Temporary: see https://github.com/IAMconsortium/pyam/issues/259
Expand Down
9 changes: 6 additions & 3 deletions message_ix/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import zipfile

import click
from ixmp import config
import ixmp
from ixmp.cli import main
import message_ix
import message_ix.tools.add_year.cli
Expand All @@ -20,6 +20,9 @@
Run `pip install [--editable] .[tests]`.
"""

# Override the class used by the ixmp CLI to load Scenario objects
ixmp.cli.ScenarioClass = message_ix.Scenario


@main.command('copy-model')
@click.option('--set-default', is_flag=True,
Expand Down Expand Up @@ -67,8 +70,8 @@ def copy_model(path, overwrite, set_default):
copyfile(src, dst)

if set_default:
config.set('message model dir', path)
config.save()
ixmp.config.set('message model dir', path)
ixmp.config.save()


@main.command()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def test_copy_model(message_ix_cli, tmp_path, tmp_env):
@pytest.mark.parametrize('opts', [
# During release prep, 'dl' will try to download e.g. v2.0.0, which does
# not yet exist; so the test fails. Use this line:
pytest.param('', marks=pytest.mark.xfail),
# pytest.param('', marks=pytest.mark.xfail),
# Otherwise (normal state on master), use this line:
# '',
'',
'--branch=master',
'--tag=1.2.0',
])
Expand Down
4 changes: 2 additions & 2 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import ixmp
import numpy as np
from numpy import testing as npt
import numpy.testing as npt
import pandas as pd
import pandas.util.testing as pdt
import pandas.testing as pdt
import pytest

from message_ix import Scenario
Expand Down
4 changes: 2 additions & 2 deletions tutorial/utils/run_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def check_local_model(model, notebook, shell=False):
mp = ixmp.Platform(dbtype='HSQLDB')
mp = ixmp.Platform()
if model in mp.scenario_list().model.unique():
mp.close_db()
return
Expand Down Expand Up @@ -41,7 +41,7 @@ def make_scenario(platform, country, name, base_scen, scen):
by = "by 'tutorial/utils/run_scenarios.py:make_scenario()'"
ds = base_ds.clone(
name, scen, "scenario generated {}, {} - {}".format(by, name, scen),
keep_sol=False)
keep_solution=False)
ds.check_out()

yield ds
Expand Down

0 comments on commit 45e630c

Please sign in to comment.