Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ repos:
- id: check-merge-conflict
- id: debug-statements
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.12
rev: v0.13.0
hooks:
- id: ruff-check # Run the linter.
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format # Run the formatter.
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.17.1"
rev: "v1.18.1"
hooks:
- id: mypy
additional_dependencies: [types-jsonschema, xarray, types-tabulate, numpy]
Expand Down
2 changes: 0 additions & 2 deletions tests/core/data/example_netcdf_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ def generate_files() -> None:
x = x_off + x_idx * res + res / 2
y = y_off + y_idx * res + res / 2

xx, yy = np.meshgrid(x, y)

# Cell IDs
cell_id = np.arange(x_n * y_n)

Expand Down
14 changes: 7 additions & 7 deletions tests/core/test_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class TestModel:
model_name = "TestModel"
vars_populated_by_init = ("test_var",)

with pytest.raises(ValueError, match="not in the known variables registry."):
with pytest.raises(ValueError, match=r"not in the known variables registry."):
variables._collect_vars_populated_by_init([TestModel])

variables.Variable(
Expand Down Expand Up @@ -207,7 +207,7 @@ class TestModel:
vars_populated_by_first_update = ("test_var",)
vars_populated_by_init = ("test_var",)

with pytest.raises(ValueError, match="not in the known variables registry."):
with pytest.raises(ValueError, match=r"not in the known variables registry."):
variables._collect_vars_populated_by_first_update([TestModel])

variables.Variable(
Expand Down Expand Up @@ -245,7 +245,7 @@ class TestModel:
model_name = "TestModel"
vars_updated = ("test_var",)

with pytest.raises(ValueError, match="not in the known variables registry."):
with pytest.raises(ValueError, match=r"not in the known variables registry."):
variables._collect_updated_by_vars([TestModel])

var = variables.Variable(
Expand Down Expand Up @@ -282,7 +282,7 @@ class TestModel:
model_name = "TestModel"
vars_required_for_update = ("test_var",)

with pytest.raises(ValueError, match="not in the known variables registry."):
with pytest.raises(ValueError, match=r"not in the known variables registry."):
variables._collect_vars_required_for_update([TestModel])

var = variables.Variable(
Expand Down Expand Up @@ -313,7 +313,7 @@ class TestModel:
model_name = "TestModel"
vars_required_for_init = ("test_var",)

with pytest.raises(ValueError, match="not in the known variables registry."):
with pytest.raises(ValueError, match=r"not in the known variables registry."):
variables._collect_vars_required_for_init([TestModel])

var = variables.Variable(
Expand Down Expand Up @@ -416,7 +416,7 @@ def test_get_variable(known_variables, run_variables):
"""Test the get_variable function."""
from virtual_ecosystem.core import variables

with pytest.raises(KeyError, match="not a known variable."):
with pytest.raises(KeyError, match=r"not a known variable."):
variables.get_variable("test_var")

var = variables.Variable(
Expand Down Expand Up @@ -500,7 +500,7 @@ def test_get_model_order(run_variables):

# Test wrong stage
with pytest.raises(
ConfigurationError, match="Stage must be either 'init' or 'update'."
ConfigurationError, match=r"Stage must be either 'init' or 'update'."
):
variables.get_model_order("wrong_stage")

Expand Down
2 changes: 1 addition & 1 deletion tests/models/animals/test_animal_cohorts.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def test_die_individual(
# Handle zero-death cases separately
if number_of_deaths == 0:
with pytest.raises(
ValueError, match="Number of deaths must be a positive integer."
ValueError, match=r"Number of deaths must be a positive integer."
):
herbivore_cohort_instance.die_individual(number_of_deaths, [])
return
Expand Down
2 changes: 1 addition & 1 deletion tests/models/hydrology/test_hydrology_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def test_generate_hydrology_model(
mock_setup.assert_called_once()

# Check arguments passed to _setup
called_args, called_kwargs = mock_setup.call_args
_called_args, called_kwargs = mock_setup.call_args
assert (
called_kwargs["initial_soil_moisture"]
== config["hydrology"]["initial_soil_moisture"]
Expand Down
4 changes: 2 additions & 2 deletions tests/models/hydrology/test_hydrology_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ def test_check_precipitation_surface_raises_error():

with pytest.raises(
ValueError,
match="Surface precipitation should not be negative! Consider checking that the"
" canopy water balance is correct.",
match=r"Surface precipitation should not be negative! "
r"Consider checking that the canopy water balance is correct.",
):
check_precipitation_surface(test_array)

Expand Down
4 changes: 2 additions & 2 deletions tests/models/plants/test_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def test_CommunityDataExporter_dump_cohort_data(
)

# First dump in write mode with no allocations: expected behaviour in setup
communities, canopies, stem_allocations = fixture_exporter_components
communities, canopies, _stem_allocations = fixture_exporter_components
exporter._dump_cohort_data(
communities=communities,
canopies=canopies,
Expand Down Expand Up @@ -639,7 +639,7 @@ def test_CommunityDataExporter_through_config(
assert exporter._write_header

# First dump in write mode with no allocations: expected behaviour in setup
communities, canopies, stem_allocations = fixture_exporter_components
communities, canopies, _stem_allocations = fixture_exporter_components
exporter.dump(
communities=communities,
canopies=canopies,
Expand Down
1 change: 0 additions & 1 deletion virtual_ecosystem/models/abiotic/wind.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ def mix_and_ventilate(

# Copy the input to update with mixing
input_variable_mixed = input_variable.copy()
n_layers, n_cells = input_variable_mixed.shape

# Extract the layer thickness and current value for the canopy layers, excluding the
# surface layer and above canopy values
Expand Down
Loading