From: Victor Stinner Date: Fri, 2 Oct 2015 15:25:50 +0000 (+0200) Subject: Port test_quobyte to Python 3 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=76bcf574184837d404b711e2f963eea60caac58e;p=openstack-build%2Fcinder-build.git Port test_quobyte to Python 3 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 --- diff --git a/cinder/tests/unit/test_quobyte.py b/cinder/tests/unit/test_quobyte.py index 12b774050..ed91d4b3c 100644 --- a/cinder/tests/unit/test_quobyte.py +++ b/cinder/tests/unit/test_quobyte.py @@ -102,9 +102,9 @@ class QuobyteDriverTestCase(test.TestCase): 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: diff --git a/tox.ini b/tox.ini index d86012f20..11dac941d 100644 --- a/tox.ini +++ b/tox.ini @@ -84,6 +84,7 @@ commands = 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 \