Merge "tests: Restore - don't reset - warning filters"

This commit is contained in:
Zuul 2023-08-08 10:41:18 +00:00 committed by Gerrit Code Review
commit 2c7f735551

View File

@ -120,6 +120,9 @@ class WarningsFixture(pyfixtures.Fixture):
def setUp(self):
super(WarningsFixture, self).setUp()
self._original_warning_filters = warnings.filters[:]
# NOTE(sdague): Make deprecation warnings only happen once. Otherwise
# this gets kind of crazy given the way that upstream python libs use
# this.
@ -138,7 +141,10 @@ class WarningsFixture(pyfixtures.Fixture):
warnings.filterwarnings(
'error', message="Property '.*' has moved to '.*'")
self.addCleanup(warnings.resetwarnings)
self.addCleanup(self._reset_warning_filters)
def _reset_warning_filters(self):
warnings.filters[:] = self._original_warning_filters
class KeystoneQuotaFixture(pyfixtures.Fixture):