legacy adapter function for functions that were previously using assert_raises with SAWarning or similar. has some workarounds to accommodate the fact that the callable completes with this approach rather than stopping at the exception raise. Also uses regex.search() to match the g
(except_cls, msg, callable_, *args, **kwargs)
| 418 | |
| 419 | |
| 420 | def assert_warns_message(except_cls, msg, callable_, *args, **kwargs): |
| 421 | """legacy adapter function for functions that were previously using |
| 422 | assert_raises with SAWarning or similar. |
| 423 | |
| 424 | has some workarounds to accommodate the fact that the callable completes |
| 425 | with this approach rather than stopping at the exception raise. |
| 426 | |
| 427 | Also uses regex.search() to match the given message to the error string |
| 428 | rather than regex.match(). |
| 429 | |
| 430 | """ |
| 431 | with _expect_warnings_sqla_only( |
| 432 | except_cls, |
| 433 | [msg], |
| 434 | search_msg=True, |
| 435 | regex=False, |
| 436 | ): |
| 437 | return callable_(*args, **kwargs) |
| 438 | |
| 439 | |
| 440 | def assert_raises_message_context_ok( |