Change database poison warning to an exception
The following warning appears in the unit test logs a number of times. "UserWarning: This test uses methods that set internal oslo_db state, but it does not claim to use the database. This will conflict with the setup of tests that do use the database and cause failures later." Note that this warning is only emitted once per unit test worker, so new offenders will show up in the logs each time you fix a test until they are all gone. This patch is intended to be merged after all the existing warnings are addressed by other patches in this series: https://review.openstack.org/#/q/topic:bug/1568414 Change-Id: I91909a356187bac70fa2fa920cebf3888410ae01 Closes-Bug: #1568414
This commit is contained in:
parent
1078ebd6c1
commit
3a01178355
|
@ -221,11 +221,10 @@ class DatabasePoisonFixture(fixtures.Fixture):
|
|||
self._poison_configure))
|
||||
|
||||
def _poison_configure(self, *a, **k):
|
||||
warnings.warn('This test uses methods that set internal oslo_db '
|
||||
'state, but it does not claim to use the database. '
|
||||
'This will conflict with the setup of tests that '
|
||||
'do use the database and cause failures later.')
|
||||
return mock.MagicMock()
|
||||
raise Exception('This test uses methods that set internal oslo_db '
|
||||
'state, but it does not claim to use the database. '
|
||||
'This will conflict with the setup of tests that '
|
||||
'do use the database and cause failures later.')
|
||||
|
||||
|
||||
class Database(fixtures.Fixture):
|
||||
|
|
Loading…
Reference in New Issue