diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-08-25 17:37:59 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-08-25 17:37:59 -0400 |
commit | e9c748a7bf1acb1423efa92ad797e9a0fbcf1cbb (patch) | |
tree | 52504c1e7364aeea3d8d58a87165f2a3343e688a /lib | |
parent | df1113ac19842ca0b30c13fb1d6031fa7f24371b (diff) | |
download | sqlalchemy-e9c748a7bf1acb1423efa92ad797e9a0fbcf1cbb.tar.gz |
- ensure rowcount is returned for an UPDATE with no implicit returning
- modernize test for that
- use py3k compatible next() in test_returning/test_versioning
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sqlalchemy/engine/base.py | 9 | ||||
-rw-r--r-- | lib/sqlalchemy/testing/mock.py | 4 |
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 257eaa18a..735113a26 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -898,11 +898,10 @@ class Connection(Connectable): elif not context._is_explicit_returning: result.close(_autoclose_connection=False) result._metadata = None - elif context.isupdate: - if context._is_implicit_returning: - context._fetch_implicit_update_returning(result) - result.close(_autoclose_connection=False) - result._metadata = None + elif context.isupdate and context._is_implicit_returning: + context._fetch_implicit_update_returning(result) + result.close(_autoclose_connection=False) + result._metadata = None elif result._metadata is None: # no results, get rowcount diff --git a/lib/sqlalchemy/testing/mock.py b/lib/sqlalchemy/testing/mock.py index 650962384..fa2d477a7 100644 --- a/lib/sqlalchemy/testing/mock.py +++ b/lib/sqlalchemy/testing/mock.py @@ -4,10 +4,10 @@ from __future__ import absolute_import from ..util import py33 if py33: - from unittest.mock import MagicMock, Mock, call + from unittest.mock import MagicMock, Mock, call, patch else: try: - from mock import MagicMock, Mock, call + from mock import MagicMock, Mock, call, patch except ImportError: raise ImportError( "SQLAlchemy's test suite requires the " |