]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Enable exception format checking when testing.
authorDan Prince <dprince@redhat.com>
Mon, 25 Mar 2013 17:47:50 +0000 (13:47 -0400)
committerDan Prince <dprince@redhat.com>
Mon, 25 Mar 2013 17:49:55 +0000 (13:49 -0400)
Updates our new exception base class to enable exception
format checking. This should help enforce that we pass
the correct kwargs to exceptions when testing.

Change-Id: I9ac62e289c0de3931861473912bb6c98b57d4126

quantum/tests/base.py

index b8b9cebab2cbd42b0bc7b72c470afc1213718e16..95664490aacc051754ee2fee8dd5b599e567c8a8 100644 (file)
@@ -21,8 +21,11 @@ import os
 
 import fixtures
 from oslo.config import cfg
+import stubout
 import testtools
 
+from quantum.openstack.common import exception
+
 CONF = cfg.CONF
 TRUE_STRING = ['True', '1']
 
@@ -53,6 +56,8 @@ class BaseTestCase(testtools.TestCase):
         if os.environ.get('OS_STDERR_NOCAPTURE') not in TRUE_STRING:
             stderr = self.useFixture(fixtures.StringStream('stderr')).stream
             self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))
+        self.stubs = stubout.StubOutForTesting()
+        self.stubs.Set(exception, '_FATAL_EXCEPTION_FORMAT_ERRORS', True)
 
     def config(self, **kw):
         """