summaryrefslogtreecommitdiff
path: root/test/lib/testing.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-01-27 20:32:52 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2012-01-27 20:32:52 -0500
commitf9c2f85a3ac35cd0158dbd818ba0b9d209003304 (patch)
tree794f4cac1bed82cfc8a7a901e090f82d15566e93 /test/lib/testing.py
parent535fc8b1500cc11cc800ee3189d30bc6d8de51a7 (diff)
downloadsqlalchemy-f9c2f85a3ac35cd0158dbd818ba0b9d209003304.tar.gz
- [bug] Fixed issue where modified session state
established after a failed flush would be committed as part of the subsequent transaction that begins automatically after manual call to rollback(). The state of the session is checked within rollback(), and if new state is present, a warning is emitted and restore_snapshot() is called a second time, discarding those changes. [ticket:2389] - repaired testing.assert_warnings to also verify that any warnings were emitted
Diffstat (limited to 'test/lib/testing.py')
-rw-r--r--test/lib/testing.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/lib/testing.py b/test/lib/testing.py
index 1d00d04d8..a84c5a7ae 100644
--- a/test/lib/testing.py
+++ b/test/lib/testing.py
@@ -358,14 +358,18 @@ def emits_warning_on(db, *warnings):
def assert_warnings(fn, warnings):
"""Assert that each of the given warnings are emitted by fn."""
+ canary = []
orig_warn = util.warn
def capture_warnings(*args, **kw):
orig_warn(*args, **kw)
popwarn = warnings.pop(0)
+ canary.append(popwarn)
eq_(args[0], popwarn)
util.warn = util.langhelpers.warn = capture_warnings
- return emits_warning()(fn)()
+ result = emits_warning()(fn)()
+ assert canary, "No warning was emitted"
+ return result
def uses_deprecated(*messages):
"""Mark a test as immune from fatal deprecation warnings.