This fixes it but there's probably something more elegant:
+if sys.version_info >= (3,0): + runtime_error = "builtins.RuntimeError" +else: + runtime_error = "exceptions.RuntimeError" +
class SslutilsTestCase(base.ServiceBaseTestCase): """Test cases for sslutils.""" @@ -38,7 +44,7 @@ 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(runtime_error) @mock.patch("os.path.exists") def test_is_enabled(self, exists_mock, runtime_error_mock):
This fixes it but there's probably something more elegant:
+if sys.version_info >= (3,0): RuntimeError" RuntimeError"
+ runtime_error = "builtins.
+else:
+ runtime_error = "exceptions.
+
class SslutilsTestCas e(base. ServiceBaseTest Case):
self. key_file_ name = os.path. join(SSL_ CERT_DIR, 'privatekey.key')
self. ca_file_ name = os.path. join(SSL_ CERT_DIR, 'ca.crt')
"""Test cases for sslutils."""
@@ -38,7 +44,7 @@
- @mock.patch( "exceptions. RuntimeError" ) runtime_ error) patch(" os.path. exists" ) enabled( self, exists_mock, runtime_ error_mock) :
+ @mock.patch(
@mock.
def test_is_