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

Set correct assertLogs levels to fix Py 3.10+ test_decorators #197

Merged
Merged
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
6 changes: 3 additions & 3 deletions cfdm/test/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_manage_log_level_via_verbosity(self):
# Highest verbosity case (note -1 == 'DEBUG', highest verbosity):
# all messages should appear, regardless of global log_level:
for argument in (-1, "DEBUG", "debug", "Debug", "DeBuG"):
with self.assertLogs(level=cfdm.log_level().value) as catch:
with self.assertLogs(level=-1) as catch:
function_to_call_to_test(verbose=argument)
for msg in log_message:
self.assertIn(msg, catch.output)
Expand All @@ -207,7 +207,7 @@ def test_manage_log_level_via_verbosity(self):
# 'DISABLE' (see note above): only warning messages should appear,
# regardless of global log_level value set:
for argument in (1, "WARNING", "warning", "Warning", "WaRning"):
with self.assertLogs(level=cfdm.log_level().value) as catch:
with self.assertLogs(level=1) as catch:
function_to_call_to_test(verbose=argument)
for msg in log_message:
if msg.split(":")[0] == "WARNING":
Expand All @@ -218,7 +218,7 @@ def test_manage_log_level_via_verbosity(self):
# Boolean cases for testing backwards compatibility...

# ... verbose=True should be equivalent to verbose=3 now:
with self.assertLogs(level=cfdm.log_level().value) as catch:
with self.assertLogs(level=3) as catch:
function_to_call_to_test(verbose=True)
for msg in log_message:
if msg.split(":")[0] == "DEBUG":
Expand Down