Skip to content

Commit

Permalink
Bump Python version for tutorials (#898)
Browse files Browse the repository at this point in the history
* Adapt tests to new pyam version
* Bump ruff version and apply it
  • Loading branch information
glatterf42 authored Dec 20, 2024
1 parent 5c0b44f commit ab9b707
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
cache: pip
cache-dependency-path: "**/pyproject.toml"

Expand Down Expand Up @@ -251,7 +251,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: # Same as the "Latest version supported by message_ix", above
python-version: "3.12"
python-version: "3.13"

- name: Force recreation of pre-commit virtual environment for mypy
if: github.event_name == 'schedule' # Comment this line to run on a PR
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repos:
- types-requests
args: ["."]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
rev: v0.8.4
hooks:
- id: ruff
- id: ruff-format
Expand Down
41 changes: 29 additions & 12 deletions message_ix/tests/test_report.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import re
import sys
from functools import partial
from pathlib import Path

Expand Down Expand Up @@ -203,18 +204,34 @@ def add_tm(df, name="Activity"):
assert not any(c in df2.columns for c in ["h", "m", "t"])

# Variable names were formatted by the callback
reg_var = pd.DataFrame(
[
["san-diego", "Activity|canning_plant|production"],
["san-diego", "Activity|transport_from_san-diego|to_chicago"],
["san-diego", "Activity|transport_from_san-diego|to_new-york"],
["san-diego", "Activity|transport_from_san-diego|to_topeka"],
["seattle", "Activity|canning_plant|production"],
["seattle", "Activity|transport_from_seattle|to_chicago"],
["seattle", "Activity|transport_from_seattle|to_new-york"],
["seattle", "Activity|transport_from_seattle|to_topeka"],
],
columns=["region", "variable"],
reg_var = (
pd.DataFrame(
[
["seattle", "Activity|canning_plant|production"],
["seattle", "Activity|transport_from_seattle|to_new-york"],
["seattle", "Activity|transport_from_seattle|to_chicago"],
["seattle", "Activity|transport_from_seattle|to_topeka"],
["san-diego", "Activity|canning_plant|production"],
["san-diego", "Activity|transport_from_san-diego|to_new-york"],
["san-diego", "Activity|transport_from_san-diego|to_chicago"],
["san-diego", "Activity|transport_from_san-diego|to_topeka"],
],
columns=["region", "variable"],
)
if sys.version_info >= (3, 10)
else pd.DataFrame(
[
["san-diego", "Activity|canning_plant|production"],
["san-diego", "Activity|transport_from_san-diego|to_chicago"],
["san-diego", "Activity|transport_from_san-diego|to_new-york"],
["san-diego", "Activity|transport_from_san-diego|to_topeka"],
["seattle", "Activity|canning_plant|production"],
["seattle", "Activity|transport_from_seattle|to_chicago"],
["seattle", "Activity|transport_from_seattle|to_new-york"],
["seattle", "Activity|transport_from_seattle|to_topeka"],
],
columns=["region", "variable"],
)
)
assert_frame_equal(df2[["region", "variable"]], reg_var)

Expand Down

0 comments on commit ab9b707

Please sign in to comment.