Don't use plain string SQL statements
Resolve the following RemovedIn20Warning warning: Using plain strings to indicate SQL statements without using the text() construct is deprecated and will be removed in version 2.0. Ensure plain SQL statements are passed using the text() construct. Change-Id: I8acdb54d168afa1a7eac270ad6165faa287311ec Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
6a013c606b
commit
8e7454c240
|
@ -82,11 +82,6 @@ class WarningsFixture(fixtures.Fixture):
|
|||
message=r'Calling the mapper\(\) function directly outside .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'once',
|
||||
message=r'Using plain strings to indicate SQL statements .*',
|
||||
category=sqla_exc.SADeprecationWarning)
|
||||
|
||||
warnings.filterwarnings(
|
||||
'once',
|
||||
message=r'The current statement is being autocommitted .*',
|
||||
|
|
|
@ -679,7 +679,7 @@ class TestExceptionCauseMySQLSavepoint(
|
|||
with session.begin():
|
||||
try:
|
||||
with session.begin_nested():
|
||||
session.execute("rollback")
|
||||
session.execute(sql.text("rollback"))
|
||||
session.add(self.A(id=1))
|
||||
# outermost is the failed SAVEPOINT rollback
|
||||
# from the "with session.begin_nested()"
|
||||
|
@ -707,7 +707,7 @@ class TestExceptionCauseMySQLSavepoint(
|
|||
|
||||
session.begin()
|
||||
try:
|
||||
session.execute("select 1")
|
||||
session.execute(sql.text("select 1"))
|
||||
|
||||
# close underying DB connection
|
||||
session.connection().connection.connection.close()
|
||||
|
@ -717,7 +717,7 @@ class TestExceptionCauseMySQLSavepoint(
|
|||
# session.execute("kill connection %s" % conn_id)
|
||||
|
||||
# try using it, will raise an error
|
||||
session.execute("select 1")
|
||||
session.execute(sql.text("select 1"))
|
||||
except exception.DBConnectionError:
|
||||
# issue being tested is that this session.rollback()
|
||||
# does not itself try to re-connect and raise another
|
||||
|
@ -732,7 +732,7 @@ class TestExceptionCauseMySQLSavepoint(
|
|||
session.begin()
|
||||
try:
|
||||
session.begin_nested()
|
||||
session.execute("select 1")
|
||||
session.execute(sql.text("select 1"))
|
||||
|
||||
# close underying DB connection
|
||||
session.connection().connection.connection.close()
|
||||
|
@ -742,7 +742,7 @@ class TestExceptionCauseMySQLSavepoint(
|
|||
# session.execute("kill connection %s" % conn_id)
|
||||
|
||||
# try using it, will raise an error
|
||||
session.execute("select 1")
|
||||
session.execute(sql.text("select 1"))
|
||||
except exception.DBConnectionError:
|
||||
# issue being tested is that this session.rollback()
|
||||
# does not itself try to re-connect and raise another
|
||||
|
|
Loading…
Reference in New Issue