Display deprecation warning in test only once

WarningsFixture class was set to display deprecation
warnings "alway" - which means every occurence of
a warning.
Since oslo.context 2.12.0 there was huge amount of such
warnings displayed. It causes functional tests fails due
to reach global timeout for tests.

Now deprecation warning should be disaplayed only on first
occurence of matching warning in test.

Change-Id: I91196a8457c25e6eb5561fb74fd5864de85a070a
Closes-Bug: 1660088
This commit is contained in:
Sławek Kapłoński
2017-01-29 09:44:03 +00:00
parent 0425a4db6e
commit afab7c6701

View File

@@ -78,7 +78,7 @@ class WarningsFixture(fixtures.Fixture):
self.addCleanup(warnings.resetwarnings)
for wtype in self.warning_types:
warnings.filterwarnings(
"always", category=wtype, module='^neutron\\.')
"once", category=wtype, module='^neutron\\.')
class OpenFixture(fixtures.Fixture):