summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/suite/test_deprecations.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-04-14 15:30:28 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-04-15 11:12:59 -0400
commit8725d89abaf1a6ce870e71fbf1a4962dc4899204 (patch)
treed9a52a8e960a3ec087a5bda1cf03b498b945d162 /lib/sqlalchemy/testing/suite/test_deprecations.py
parentf39cf13680a0ee5b190d498d29ea31c76f546dfb (diff)
downloadsqlalchemy-8725d89abaf1a6ce870e71fbf1a4962dc4899204.tar.gz
Pass connection to TablesTest.insert_data()
towards the goal of reducing verbosity and repetition in test fixtures as well as that we are moving to connection only for execution, move the insert_data() classmethod to accept a connection and adjust all fixtures to use it. Change-Id: I3bf534acca0d5f4cda1d4da8ae91f1155b829b09
Diffstat (limited to 'lib/sqlalchemy/testing/suite/test_deprecations.py')
-rw-r--r--lib/sqlalchemy/testing/suite/test_deprecations.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_deprecations.py b/lib/sqlalchemy/testing/suite/test_deprecations.py
index 126d82fe9..8c25616a8 100644
--- a/lib/sqlalchemy/testing/suite/test_deprecations.py
+++ b/lib/sqlalchemy/testing/suite/test_deprecations.py
@@ -1,4 +1,3 @@
-from .. import config
from .. import fixtures
from ..assertions import eq_
from ..schema import Column
@@ -23,17 +22,16 @@ class DeprecatedCompoundSelectTest(fixtures.TablesTest):
)
@classmethod
- def insert_data(cls):
- with config.db.connect() as conn:
- conn.execute(
- cls.tables.some_table.insert(),
- [
- {"id": 1, "x": 1, "y": 2},
- {"id": 2, "x": 2, "y": 3},
- {"id": 3, "x": 3, "y": 4},
- {"id": 4, "x": 4, "y": 5},
- ],
- )
+ def insert_data(cls, connection):
+ connection.execute(
+ cls.tables.some_table.insert(),
+ [
+ {"id": 1, "x": 1, "y": 2},
+ {"id": 2, "x": 2, "y": 3},
+ {"id": 3, "x": 3, "y": 4},
+ {"id": 4, "x": 4, "y": 5},
+ ],
+ )
def _assert_result(self, conn, select, result, params=()):
eq_(conn.execute(select, params).fetchall(), result)