Fix to not use empty IN clause
When an empty IN clause is used with sqlalchemy, a warning is printed: SAWarning: The IN-predicate on "assignment.actor_id" was invoked with an empty sequence. ... With this fix, these warnings should no longer be printed. The tests are changed to convert these warnings into errors. Change-Id: I58c7e5f11fdac9bbc1e9a970ce690ea113e2bd95 Closes-Bug: #1404354
This commit is contained in:
@@ -13,7 +13,9 @@
|
||||
# under the License.
|
||||
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
from sqlalchemy import exc
|
||||
from testtools import matchers
|
||||
|
||||
from keystone.openstack.common import log
|
||||
@@ -35,3 +37,8 @@ class TestTestCase(tests.TestCase):
|
||||
self.assertThat(
|
||||
lambda: LOG.warn('String %(p1)s %(p2)s', {'p1': 'something'}),
|
||||
matchers.raises(tests.BadLog))
|
||||
|
||||
def test_sa_warning(self):
|
||||
self.assertThat(
|
||||
lambda: warnings.warn('test sa warning error', exc.SAWarning),
|
||||
matchers.raises(exc.SAWarning))
|
||||
|
||||
Reference in New Issue
Block a user