diff --git a/pyproject.toml b/pyproject.toml index 92a68e1fb..143fcf0de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,7 @@ dependencies = [ "resfo-utilities>=0.1.1", "polars", "fastexcel", + "packaging>=26.3", ] [dependency-groups] dev = [ diff --git a/tests/conftest.py b/tests/conftest.py index b6f3617cc..4a8479aef 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,15 +2,19 @@ import os import shutil import subprocess +from importlib.metadata import version from pathlib import Path -import cwrap import pytest from hypothesis import HealthCheck, settings +from packaging.version import Version from resdata import ResDataType from resdata.grid import GridGenerator from resdata.resfile import ResdataKW +if Version(version("resdata")).major < 7: + import cwrap + from tests import legacy_test_data # Timeout settings are unreliable both on CI and @@ -121,7 +125,11 @@ def fixture_grid_prop(): def wrapper(prop_name, value, grid_size, fname): prop = ResdataKW(prop_name, grid_size, ResDataType.RD_FLOAT) prop.assign(value) - with cwrap.open(fname, "w") as file: - prop.write_grdecl(file) + if Version(version("resdata")).major < 7: + with cwrap.open(fname, "w") as file: + prop.write_grdecl(file) + else: + with Path(fname).open(mode="w", encoding="utf-8") as file: + prop.write_grdecl(file) return wrapper diff --git a/uv.lock b/uv.lock index decc70ad2..4420c1b22 100644 --- a/uv.lock +++ b/uv.lock @@ -4,11 +4,11 @@ requires-python = ">=3.12" resolution-markers = [ "python_full_version >= '3.15' and platform_machine == 'ARM64' and sys_platform == 'win32'", "python_full_version >= '3.15' and platform_machine != 'ARM64' and sys_platform == 'win32'", + "python_full_version >= '3.15' and sys_platform == 'emscripten'", + "python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version == '3.14.*' and platform_machine == 'ARM64' and sys_platform == 'win32'", "python_full_version == '3.14.*' and platform_machine != 'ARM64' and sys_platform == 'win32'", - "python_full_version >= '3.15' and sys_platform == 'emscripten'", "python_full_version == '3.14.*' and sys_platform == 'emscripten'", - "python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version == '3.14.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version < '3.14' and platform_machine == 'ARM64' and sys_platform == 'win32'", "python_full_version < '3.14' and platform_machine != 'ARM64' and sys_platform == 'win32'", @@ -3743,6 +3743,7 @@ dependencies = [ { name = "fastexcel" }, { name = "fmu-ensemble" }, { name = "numpy" }, + { name = "packaging" }, { name = "pandas" }, { name = "polars" }, { name = "probabilit" }, @@ -3788,6 +3789,7 @@ requires-dist = [ { name = "fastexcel" }, { name = "fmu-ensemble", specifier = ">1.6.5" }, { name = "numpy" }, + { name = "packaging", specifier = ">=26.3" }, { name = "pandas", specifier = ">=2" }, { name = "polars" }, { name = "probabilit", specifier = ">=0.4.1" },