iiasa / ixmp

The ix modeling platform for integrated and cross-cutting scenario analysis
https://docs.messageix.org/ixmp
Apache License 2.0
36 stars 110 forks source link

Return *only* the version from gams_version() #505

Closed khaeru closed 6 months ago

khaeru commented 6 months ago

Fix a regression introduced in #502 that resulted in this downstream failure:

______________________________ test_message_macro ______________________________

    def test_message_macro():
        # Constructor runs successfully
        MESSAGE_MACRO()

        class _MM(MESSAGE_MACRO):
            """Dummy subclass requiring a non-existent GAMS version."""

            GAMS_min_version = "99.9.9"

        # Constructor complains about an insufficient GAMS version
>       with pytest.raises(
            RuntimeError, match="MESSAGE-MACRO requires GAMS >= " "99.9.9; found "
        ):
E       Failed: DID NOT RAISE <class 'RuntimeError'>

message_ix/tests/test_models.py:38: Failed

Also add a test to check this expectation.

How to review

PR checklist

khaeru commented 6 months ago

@glatterf42 this PR is appropriate for a rebase or squash!

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (e0a48a4) 98.9% compared to head (9c759e8) 98.9%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #505 +/- ## ===================================== Coverage 98.9% 98.9% ===================================== Files 44 44 Lines 4792 4794 +2 ===================================== + Hits 4741 4743 +2 Misses 51 51 ``` | [Files](https://app.codecov.io/gh/iiasa/ixmp/pull/505?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iiasa) | Coverage Δ | | |---|---|---| | [ixmp/model/gams.py](https://app.codecov.io/gh/iiasa/ixmp/pull/505?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iiasa#diff-aXhtcC9tb2RlbC9nYW1zLnB5) | `100.0% <100.0%> (ø)` | | | [ixmp/tests/test\_model.py](https://app.codecov.io/gh/iiasa/ixmp/pull/505?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=iiasa#diff-aXhtcC90ZXN0cy90ZXN0X21vZGVsLnB5) | `100.0% <100.0%> (ø)` | |
glatterf42 commented 6 months ago

On second thought, macos 3.12 has produced two different errors, one of which is still in backend/test_jdbc.py/test_del_ts, so let's see if that's spurious or something to worry about by running the test a third time.