]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
dont test squelched warnings against the filter
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 23 Jan 2022 14:28:22 +0000 (09:28 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 23 Jan 2022 14:30:02 +0000 (09:30 -0500)
I spent days on Ibcf09af25228d39ee5a943fda82d8a9302433726
reading it over and over again and noticed this slight inaccuracy
10 seconds after I merged it.

the assert_warns_message() and assert_warns() functions should
not consider a mismatched warning class as valid for a match.

Change-Id: Ib8944dd95bcec1a7e4963917a5f4829e2ba27732
(cherry picked from commit f653d5eb169e3d0371eae388aecb0db0cb0b8c11)

lib/sqlalchemy/testing/assertions.py

index aa8edd9affbc3b8b17e195eca5c48421b9b95f65..9a3c06b029039b9f01946758256a4972bccb7f4e 100644 (file)
@@ -192,6 +192,8 @@ def _expect_warnings(
             if not exception or not issubclass(exception, _EXC_CLS):
                 if not squelch_other_warnings:
                     return real_warn(msg, *arg, **kw)
+                else:
+                    return
 
             if not filters and not raise_on_any_unexpected:
                 return