From f05404766bb24d234d5bd7003d372e1c68468aa0 Mon Sep 17 00:00:00 2001 From: Elias <110238618+ESadek-MO@users.noreply.github.com> Date: Fri, 22 Sep 2023 12:44:40 +0100 Subject: [PATCH] Replaced pkg_resources version parser with packager version parser. (#5511) * removed pkg_resources version parse references * Corrected pull num * Fix What's New indentation * Fix What's New indentation. --------- Co-authored-by: Martin Yeo <40734014+trexfeathers@users.noreply.github.com> --- docs/src/whatsnew/latest.rst | 5 +++-- .../tests/unit/experimental/ugrid/mesh/test_Connectivity.py | 4 ++-- .../tests/unit/experimental/ugrid/mesh/test_MeshCoord.py | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/src/whatsnew/latest.rst b/docs/src/whatsnew/latest.rst index 4c732c43df..b342a51a01 100644 --- a/docs/src/whatsnew/latest.rst +++ b/docs/src/whatsnew/latest.rst @@ -84,8 +84,9 @@ This document explains the changes made to Iris for this release working properly. (Main pull request: :pull:`5437`, more detail: :pull:`5430`, :pull:`5431`, :pull:`5432`, :pull:`5434`, :pull:`5436`) -#. `@acchamber`_ removed several warnings from iris related to Numpy 1.25 deprecations. - (:pull:`5493`) +#. `@acchamber`_ and `@ESadek-MO`_ resolved several deprecation to reduce + number of warnings raised during tests. + (:pull:`5493`, :pull:`5511`) #. `@trexfeathers`_ replaced all uses of the ``logging.WARNING`` level, in favour of using Python warnings, following team agreement. (:pull:`5488`) diff --git a/lib/iris/tests/unit/experimental/ugrid/mesh/test_Connectivity.py b/lib/iris/tests/unit/experimental/ugrid/mesh/test_Connectivity.py index f343f4be24..7e90555801 100644 --- a/lib/iris/tests/unit/experimental/ugrid/mesh/test_Connectivity.py +++ b/lib/iris/tests/unit/experimental/ugrid/mesh/test_Connectivity.py @@ -14,7 +14,7 @@ import numpy as np from numpy import ma -from pkg_resources import parse_version +from packaging import version from iris._lazy_data import as_lazy_data, is_lazy_data from iris.experimental.ugrid.mesh import Connectivity @@ -63,7 +63,7 @@ def test_indices(self): def test_read_only(self): attributes = ("indices", "cf_role", "start_index", "location_axis") - if parse_version(python_version()) >= parse_version("3.11"): + if version.parse(python_version()) >= version.parse("3.11"): msg = "object has no setter" else: msg = "can't set attribute" diff --git a/lib/iris/tests/unit/experimental/ugrid/mesh/test_MeshCoord.py b/lib/iris/tests/unit/experimental/ugrid/mesh/test_MeshCoord.py index cb90c176b6..ba7306bded 100644 --- a/lib/iris/tests/unit/experimental/ugrid/mesh/test_MeshCoord.py +++ b/lib/iris/tests/unit/experimental/ugrid/mesh/test_MeshCoord.py @@ -17,7 +17,7 @@ import dask.array as da import numpy as np -from pkg_resources import parse_version +from packaging import version import pytest from iris._lazy_data import as_lazy_data, is_lazy_data @@ -79,7 +79,7 @@ def setUp(self): def test_fixed_metadata(self): # Check that you cannot set any of these on an existing MeshCoord. meshcoord = self.meshcoord - if parse_version(python_version()) >= parse_version("3.11"): + if version.parse(python_version()) >= version.parse("3.11"): msg = "object has no setter" else: msg = "can't set attribute"