summaryrefslogtreecommitdiff
path: root/test/lib/testing.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-11-30 20:39:06 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2010-11-30 20:39:06 -0500
commitdf7379f992938af7ec05f0c46ccef3305ebcd5cc (patch)
treecdd86ba9e88bdadd3c9ead36751b46b736722d16 /test/lib/testing.py
parent3c9d2d7b2f76fc18c0f1141a813a7045ac8cb853 (diff)
downloadsqlalchemy-df7379f992938af7ec05f0c46ccef3305ebcd5cc.tar.gz
- modernize multiple warning assertions for PG reflect index test
Diffstat (limited to 'test/lib/testing.py')
-rw-r--r--test/lib/testing.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/lib/testing.py b/test/lib/testing.py
index 00b65c6e3..8f4838d0a 100644
--- a/test/lib/testing.py
+++ b/test/lib/testing.py
@@ -387,6 +387,18 @@ def emits_warning_on(db, *warnings):
return function_named(maybe, fn.__name__)
return decorate
+def assert_warnings(fn, warnings):
+ """Assert that each of the given warnings are emitted by fn."""
+
+ orig_warn = util.warn
+ def capture_warnings(*args, **kw):
+ orig_warn(*args, **kw)
+ popwarn = warnings.pop(0)
+ eq_(args[0], popwarn)
+ util.warn = util.langhelpers.warn = capture_warnings
+
+ return emits_warning()(fn)()
+
def uses_deprecated(*messages):
"""Mark a test as immune from fatal deprecation warnings.