Skip to content

Commit

Permalink
[CI Bot] environment lockfiles auto-update (#5547)
Browse files Browse the repository at this point in the history
* Updated environment lockfiles

* Fix test to ignore extra warnings from later versions of distributed. (#5600)

---------

Co-authored-by: Lockfile bot <[email protected]>
Co-authored-by: Patrick Peglar <[email protected]>
  • Loading branch information
3 people authored Nov 22, 2023
1 parent 5b93be6 commit 54582d9
Show file tree
Hide file tree
Showing 4 changed files with 211 additions and 193 deletions.
32 changes: 25 additions & 7 deletions lib/iris/tests/integration/netcdf/test_delayed_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
Integration tests for delayed saving.
"""
import re
import warnings

from cf_units import Unit
Expand Down Expand Up @@ -197,19 +198,36 @@ def test_scheduler_types(

if not save_is_delayed:
assert result is None
assert len(logged_warnings) == 2
issued_warnings = [log.message for log in logged_warnings]
else:
assert result is not None
assert len(logged_warnings) == 0
warnings.simplefilter("error")
issued_warnings = result.compute()
with warnings.catch_warnings(record=True) as logged_warnings:
# The compute *returns* warnings from the delayed operations.
issued_warnings = result.compute()
issued_warnings = [
log.message for log in logged_warnings
] + issued_warnings

warning_messages = [warning.args[0] for warning in issued_warnings]
if scheduler_type == "DistributedScheduler":
# Ignore any "large data transfer" messages generated,
# specifically when testing with the Distributed scheduler.
# These may not always occur and don't reflect something we want to
# test for.
large_transfer_message_regex = re.compile(
"Sending large graph.* may cause some slowdown", re.DOTALL
)
warning_messages = [
message
for message in warning_messages
if not large_transfer_message_regex.search(message)
]

assert len(issued_warnings) == 2
# In all cases, should get 2 fill value warnings overall.
assert len(warning_messages) == 2
expected_msg = "contains unmasked data points equal to the fill-value"
assert all(
expected_msg in warning.args[0] for warning in issued_warnings
)
assert all(expected_msg in message for message in warning_messages)

def test_time_of_writing(
self, save_is_delayed, output_path, scheduler_type
Expand Down
Loading

0 comments on commit 54582d9

Please sign in to comment.