Remove ExceptionTestCase

Since the switch to stestr, it appears any tests that output a large
amount of logging can cause subparser errors. One of the tests that
seems to occasionally trigger this is in test_exceptions where it
loads all classes from cinder/exception.py and asserts that attempting
to raise the class results in it being raised.

Many of the exceptions require message formatting values passed in.
The base CinderException handles this, but it also logs when this is
the case. So looping through all the exceptions results in a lot of
log messages for these missing format values.

Since all this does is assert that raising the exception raises the
exception, there is little value to this test. Arguably the only thing
it does is enforce that non-exception classes can't be added to
exception.py as those would raise a TypeError rather than the expected
exception, but that does not seem like something we should care about
enforcing. At least not in a unit test.

Change-Id: I56c37bb2f5fa20356341e5736745117806463644
Partial-bug: #1728640
This commit is contained in:
Sean McGinnis 2017-11-17 14:56:03 -06:00
parent 4cbc03a0bd
commit 402ded572d
1 changed files with 2 additions and 16 deletions

View File

@ -15,27 +15,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from cinder import exception
from cinder import test
import mock
import six
from six.moves import http_client
import webob.util
class ExceptionTestCase(test.TestCase):
@staticmethod
def _raise_exc(exc):
raise exc()
def test_exceptions_raise(self):
# NOTE(dprince): disable format errors since we are not passing kwargs
self.flags(fatal_exception_format_errors=False)
for name in dir(exception):
exc = getattr(exception, name)
if isinstance(exc, type):
self.assertRaises(exc, self._raise_exc, exc)
from cinder import exception
from cinder import test
class CinderExceptionTestCase(test.TestCase):