Skip to content

Commit

Permalink
fix tests and lockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenworsley committed Feb 27, 2025
1 parent 79ab1b4 commit f5ddd88
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 95 deletions.
1 change: 1 addition & 0 deletions lib/iris/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@

#: Basepath for test results.
_RESULT_PATH = os.path.join(os.path.dirname(__file__), "results")
MIN_PICKLE_PROTOCOL = 4

if "--data-files-used" in sys.argv:
sys.argv.remove("--data-files-used")
Expand Down
2 changes: 1 addition & 1 deletion lib/iris/tests/integration/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
# Import iris.tests first so that some things can be initialised before
# importing anything else.
import iris.tests as tests # isort:skip
from iris.tests import MIN_PICKLE_PROTOCOL

import pickle

import pytest

import iris

MIN_PICKLE_PROTOCOL = 4
TESTED_PROTOCOLS = list(range(MIN_PICKLE_PROTOCOL, pickle.HIGHEST_PROTOCOL + 1))


Expand Down
3 changes: 2 additions & 1 deletion lib/iris/tests/test_pickling.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Import iris tests first so that some things can be initialised
# before importing anything else.
import iris.tests as tests # isort:skip
from iris.tests import MIN_PICKLE_PROTOCOL

import io
import pickle
Expand All @@ -21,7 +22,7 @@
class TestPickle(tests.IrisTest):
def pickle_then_unpickle(self, obj):
"""Returns a generator of ("pickle protocol number", object) tuples."""
for protocol in range(1 + pickle.HIGHEST_PROTOCOL):
for protocol in range(MIN_PICKLE_PROTOCOL, pickle.HIGHEST_PROTOCOL + 1):
bio = io.BytesIO()
pickle.dump(obj, bio, protocol)

Expand Down
4 changes: 2 additions & 2 deletions lib/iris/tests/unit/fileformats/pp/test__interpret_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ def test_landsea_unpacking_uses_dask(self):
# Get the 'main' calculation entry.
mask_toplev_item = lazy_mask_array.dask[mask_toplev_key]
# This should be a task (a simple fetch).
self.assertTrue(callable(mask_toplev_item[0]))
self.assertTrue(callable(mask_toplev_item))
# Get the key (name) of the array that it fetches.
mask_data_name = mask_toplev_item[1]
mask_data_name = mask_toplev_item.args[0].key

# Check that the item this refers to is a PPDataProxy.
self.assertIsInstance(lazy_mask_array.dask[mask_data_name], pp.PPDataProxy)
Expand Down
Loading

0 comments on commit f5ddd88

Please sign in to comment.