summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <stephenfin@redhat.com>2021-08-16 12:53:46 +0100
committerStephen Finucane <stephenfin@redhat.com>2022-02-08 14:40:36 +0000
commit6ecce8996188a63ba18c607dd10dd58c9c21f2b8 (patch)
tree5d4a3ce06dfc57d12bd8afcd639c904776794963
parent22c602f075795b6d5ecbbc2e229817f759613ea2 (diff)
downloadoslo-db-6ecce8996188a63ba18c607dd10dd58c9c21f2b8.tar.gz
Don't call 'begin()' on existing transaction
Resolve the following RemovedIn20Warning warning: Calling .begin() when a transaction is already begun, creating a 'sub' transaction, is deprecated and will be removed in 2.0. See the documentation section 'Migrating from the nesting pattern' for background on how to migrate from this pattern. Change-Id: I59e45dfea8fcbf72fc6e34345e510554cbdd138e Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
-rw-r--r--oslo_db/tests/fixtures.py5
-rw-r--r--oslo_db/tests/sqlalchemy/test_utils.py3
2 files changed, 1 insertions, 7 deletions
diff --git a/oslo_db/tests/fixtures.py b/oslo_db/tests/fixtures.py
index 4646278..468dcae 100644
--- a/oslo_db/tests/fixtures.py
+++ b/oslo_db/tests/fixtures.py
@@ -45,11 +45,6 @@ class WarningsFixture(fixtures.Fixture):
message=r'The Session.autocommit parameter is deprecated .*',
category=sqla_exc.SADeprecationWarning)
- warnings.filterwarnings(
- 'once',
- message=r'Calling \.begin\(\) when a transaction is already .*',
- category=sqla_exc.SADeprecationWarning)
-
# ...plus things that aren't our fault
# FIXME(stephenfin): These are caused by sqlalchemy-migrate, not us,
diff --git a/oslo_db/tests/sqlalchemy/test_utils.py b/oslo_db/tests/sqlalchemy/test_utils.py
index 087f7ec..27ed640 100644
--- a/oslo_db/tests/sqlalchemy/test_utils.py
+++ b/oslo_db/tests/sqlalchemy/test_utils.py
@@ -700,8 +700,7 @@ class TestMigrationUtils(db_test_base._DbTestCase):
test_table.create(engine)
with engine.connect() as conn, conn.begin():
- with conn.begin():
- conn.execute(test_table.insert(), values)
+ conn.execute(test_table.insert(), values)
return test_table, values
def test_drop_old_duplicate_entries_from_table(self):