Modify assertRaisesAndMessageMatches() to tolerate subclasses. On
Python 3, a permission error now raises an exception PermissionError
which is a subclass of OSError, whereas the test expected exactly the
OSError type.
Partial-Implements: blueprint cinder-python3
Change-Id: Ia232c27de6a67eafad30b25301531e292fe349dc
callableObj(*args, **kwargs)
except Exception as exc:
caught = True
- self.assertEqual(excClass, type(exc),
- 'Wrong exception caught: %s Stacktrace: %s' %
- (exc, traceback.format_exc()))
+ self.assertIsInstance(exc, excClass,
+ 'Wrong exception caught: %s Stacktrace: %s' %
+ (exc, traceback.format_exc()))
self.assertIn(msg, six.text_type(exc))
if not caught:
cinder.tests.unit.test_nimble \
cinder.tests.unit.test_pure \
cinder.tests.unit.test_qos_specs \
+ cinder.tests.unit.test_quobyte \
cinder.tests.unit.test_quota \
cinder.tests.unit.test_rbd \
cinder.tests.unit.test_remotefs \