diff options
Diffstat (limited to 'oslo_db/tests/fixtures.py')
-rw-r--r-- | oslo_db/tests/fixtures.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/oslo_db/tests/fixtures.py b/oslo_db/tests/fixtures.py index 502719b..acc260d 100644 --- a/oslo_db/tests/fixtures.py +++ b/oslo_db/tests/fixtures.py @@ -21,6 +21,9 @@ class WarningsFixture(fixtures.Fixture): def setUp(self): super().setUp() + + self._original_warning_filters = warnings.filters[:] + # Make deprecation warnings only happen once to avoid spamming warnings.simplefilter('once', DeprecationWarning) @@ -75,4 +78,7 @@ class WarningsFixture(fixtures.Fixture): module='migrate', category=sqla_exc.SADeprecationWarning) - self.addCleanup(warnings.resetwarnings) + self.addCleanup(self._reset_warning_filters) + + def _reset_warning_filters(self): + warnings.filters[:] = self._original_warning_filters |