Browse Source

consume WarningsFixture from neutron-lib

The WarningsFixture is in neutron-lib. This patch consumes it by
removing it from neutron and using from lib instead.

NeutronLibImpact

Change-Id: I4a04ca25e56b1d93ae49026b35d108a89545447a
changes/70/651370/3
Boden R 2 years ago
parent
commit
6f18693438
  1. 3
      neutron/tests/base.py
  2. 15
      neutron/tests/tools.py

3
neutron/tests/base.py

@ -55,7 +55,6 @@ from neutron import manager
from neutron import policy
from neutron.quota import resource_registry
from neutron.tests import post_mortem_debug
from neutron.tests import tools
CONF = cfg.CONF
@ -230,7 +229,7 @@ class DietTestCase(base.BaseTestCase):
debugger))
# Make sure we see all relevant deprecation warnings when running tests
self.useFixture(tools.WarningsFixture())
self.useFixture(fixture.WarningsFixture(module_re=['^neutron\\.']))
self.useFixture(fixture.DBQueryHooksFixture())

15
neutron/tests/tools.py

@ -15,7 +15,6 @@
import datetime
import random
import warnings
import fixtures
import netaddr
@ -39,20 +38,6 @@ except ImportError as e:
_CALLBACK_PRIORITY_SUPPORTED = False
class WarningsFixture(fixtures.Fixture):
"""Filters out warnings during test runs."""
warning_types = (
DeprecationWarning, PendingDeprecationWarning, ImportWarning
)
def _setUp(self):
self.addCleanup(warnings.resetwarnings)
for wtype in self.warning_types:
warnings.filterwarnings(
"once", category=wtype, module='^neutron\\.')
class SafeCleanupFixture(fixtures.Fixture):
"""Catch errors in daughter fixture cleanup."""

Loading…
Cancel
Save