Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI Bot] environment lockfiles auto-update #5547

Merged
merged 2 commits into from
Nov 22, 2023
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
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 @@ -190,19 +191,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
Loading