from neutron import policy
from neutron.tests import fake_notifier
from neutron.tests import post_mortem_debug
+from neutron.tests import tools
CONF = cfg.CONF
self.addOnException(post_mortem_debug.get_exception_handler(
debugger))
+ # Make sure we see all relevant deprecation warnings when running tests
+ self.useFixture(tools.WarningsFixture())
+
if bool_from_env('OS_DEBUG'):
_level = std_logging.DEBUG
else:
# License for the specific language governing permissions and limitations
# under the License.
+import warnings
+
import fixtures
import six
attributes.RESOURCE_ATTRIBUTE_MAP = self.contents_backup
+class WarningsFixture(fixtures.Fixture):
+ """Filters out warnings during test runs."""
+
+ warning_types = (
+ DeprecationWarning, PendingDeprecationWarning, ImportWarning
+ )
+
+ def setUp(self):
+ super(WarningsFixture, self).setUp()
+ for wtype in self.warning_types:
+ warnings.filterwarnings(
+ "always", category=wtype, module='^neutron\\.')
+ self.addCleanup(warnings.resetwarnings)
+
+
"""setup_mock_calls and verify_mock_calls are convenient methods
to setup a sequence of mock calls.