Enable py3 mock.patch of RuntimeError

RuntimeError is moved to builtins in Python3.x so adjust
the @mock.patch accordingly when running in Python3.x.

Change-Id: I5e1ce3ed40add635ce25bc1d80f88dc7ad9d2c59
Closes-Bug: #1522551
This commit is contained in:
Corey Bryant 2015-12-09 11:02:47 -05:00
parent 4204fe0d15
commit 21b0e716ac

View File

@ -38,7 +38,7 @@ class SslutilsTestCase(base.ServiceBaseTestCase):
self.key_file_name = os.path.join(SSL_CERT_DIR, 'privatekey.key')
self.ca_file_name = os.path.join(SSL_CERT_DIR, 'ca.crt')
@mock.patch("exceptions.RuntimeError")
@mock.patch("%s.RuntimeError" % RuntimeError.__module__)
@mock.patch("os.path.exists")
def test_is_enabled(self, exists_mock, runtime_error_mock):
exists_mock.return_value = True