diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-04-14 15:30:28 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-04-15 11:12:59 -0400 |
commit | 8725d89abaf1a6ce870e71fbf1a4962dc4899204 (patch) | |
tree | d9a52a8e960a3ec087a5bda1cf03b498b945d162 /lib/sqlalchemy/testing/suite/test_cte.py | |
parent | f39cf13680a0ee5b190d498d29ea31c76f546dfb (diff) | |
download | sqlalchemy-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_cte.py')
-rw-r--r-- | lib/sqlalchemy/testing/suite/test_cte.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/lib/sqlalchemy/testing/suite/test_cte.py b/lib/sqlalchemy/testing/suite/test_cte.py index fab457606..1ee6cac10 100644 --- a/lib/sqlalchemy/testing/suite/test_cte.py +++ b/lib/sqlalchemy/testing/suite/test_cte.py @@ -36,18 +36,17 @@ class CTETest(fixtures.TablesTest): ) @classmethod - def insert_data(cls): - with config.db.connect() as conn: - conn.execute( - cls.tables.some_table.insert(), - [ - {"id": 1, "data": "d1", "parent_id": None}, - {"id": 2, "data": "d2", "parent_id": 1}, - {"id": 3, "data": "d3", "parent_id": 1}, - {"id": 4, "data": "d4", "parent_id": 3}, - {"id": 5, "data": "d5", "parent_id": 3}, - ], - ) + def insert_data(cls, connection): + connection.execute( + cls.tables.some_table.insert(), + [ + {"id": 1, "data": "d1", "parent_id": None}, + {"id": 2, "data": "d2", "parent_id": 1}, + {"id": 3, "data": "d3", "parent_id": 1}, + {"id": 4, "data": "d4", "parent_id": 3}, + {"id": 5, "data": "d5", "parent_id": 3}, + ], + ) def test_select_nonrecursive_round_trip(self): some_table = self.tables.some_table |