diff options
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r-- | lib/sqlalchemy/sql/schema.py | 9 | ||||
-rw-r--r-- | lib/sqlalchemy/testing/fixtures.py | 7 | ||||
-rw-r--r-- | lib/sqlalchemy/testing/suite/test_rowcount.py | 11 | ||||
-rw-r--r-- | lib/sqlalchemy/testing/warnings.py | 5 |
4 files changed, 19 insertions, 13 deletions
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py index 0ffb6bcc3..36d69456e 100644 --- a/lib/sqlalchemy/sql/schema.py +++ b/lib/sqlalchemy/sql/schema.py @@ -2685,9 +2685,12 @@ class Sequence(IdentityOptions, roles.StatementRole, DefaultGenerator): for this :class:`.Sequence` within any SQL expression. """ - return util.preloaded.sql_functions.func.next_value( - self, bind=self.bind - ) + if self.bind: + return util.preloaded.sql_functions.func.next_value( + self, bind=self.bind + ) + else: + return util.preloaded.sql_functions.func.next_value(self) def _set_parent(self, column, **kw): super(Sequence, self)._set_parent(column) diff --git a/lib/sqlalchemy/testing/fixtures.py b/lib/sqlalchemy/testing/fixtures.py index 209ea415e..ac4d3d8fa 100644 --- a/lib/sqlalchemy/testing/fixtures.py +++ b/lib/sqlalchemy/testing/fixtures.py @@ -176,7 +176,6 @@ class TablesTest(TestBase): cls.bind = cls.setup_bind() cls._tables_metadata = sa.MetaData() - cls._tables_metadata.bind = cls.bind @classmethod def _setup_once_inserts(cls): @@ -354,6 +353,12 @@ def create_session(**kw): return sa.orm.Session(config.db, **kw) +def fixture_session(**kw): + kw.setdefault("autoflush", True) + kw.setdefault("expire_on_commit", True) + return sa.orm.Session(config.db, **kw) + + class ORMTest(_ORMTest, TestBase): pass diff --git a/lib/sqlalchemy/testing/suite/test_rowcount.py b/lib/sqlalchemy/testing/suite/test_rowcount.py index f3f902abd..bb344237a 100644 --- a/lib/sqlalchemy/testing/suite/test_rowcount.py +++ b/lib/sqlalchemy/testing/suite/test_rowcount.py @@ -1,6 +1,7 @@ from sqlalchemy import bindparam from sqlalchemy import Column from sqlalchemy import Integer +from sqlalchemy import select from sqlalchemy import Sequence from sqlalchemy import String from sqlalchemy import Table @@ -51,12 +52,14 @@ class RowCountTest(fixtures.TablesTest): [{"name": n, "department": d} for n, d in data], ) - def test_basic(self): + def test_basic(self, connection): employees_table = self.tables.employees - s = employees_table.select() - r = s.execute().fetchall() + s = select( + employees_table.c.name, employees_table.c.department + ).order_by(employees_table.c.employee_id) + rows = connection.execute(s).fetchall() - assert len(r) == len(self.data) + eq_(rows, self.data) def test_update_rowcount1(self, connection): employees_table = self.tables.employees diff --git a/lib/sqlalchemy/testing/warnings.py b/lib/sqlalchemy/testing/warnings.py index c948ba66f..1b078a263 100644 --- a/lib/sqlalchemy/testing/warnings.py +++ b/lib/sqlalchemy/testing/warnings.py @@ -62,11 +62,6 @@ def setup_filters(): r"The Connection.connect\(\) method is considered legacy", # r".*DefaultGenerator.execute\(\)", # - # bound metadaa - # - r"The ``bind`` argument for schema methods that invoke SQL ", - r"The Function.bind argument", - r"The select.bind argument", # # result sets # |