Context manager which expects one or more warnings. With no arguments, squelches all SAWarning emitted via sqlalchemy.util.warn and sqlalchemy.util.warn_limited. Otherwise pass string expressions that will match selected warnings via regex; all non-matching warnings are sent throu
(*messages, **kw)
| 35 | |
| 36 | |
| 37 | def expect_warnings(*messages, **kw): |
| 38 | """Context manager which expects one or more warnings. |
| 39 | |
| 40 | With no arguments, squelches all SAWarning emitted via |
| 41 | sqlalchemy.util.warn and sqlalchemy.util.warn_limited. Otherwise |
| 42 | pass string expressions that will match selected warnings via regex; |
| 43 | all non-matching warnings are sent through. |
| 44 | |
| 45 | The expect version **asserts** that the warnings were in fact seen. |
| 46 | |
| 47 | Note that the test suite sets SAWarning warnings to raise exceptions. |
| 48 | |
| 49 | """ # noqa |
| 50 | return _expect_warnings_sqla_only(sa_exc.SAWarning, messages, **kw) |
| 51 | |
| 52 | |
| 53 | @contextlib.contextmanager |