Fix pylint3 errors about "deprecated-method".
Bug: 143197659
Test: # Change Python version to python3
pylint3 internal/lib/gcompute_client.py
pylint3 internal/lib/gcompute_client_test.py
Change-Id: If3bef631a33db7d20e071edd39c1b1512860aed1
diff --git a/internal/lib/gcompute_client_test.py b/internal/lib/gcompute_client_test.py
index 5f14f7e..d67c50b 100644
--- a/internal/lib/gcompute_client_test.py
+++ b/internal/lib/gcompute_client_test.py
@@ -20,6 +20,7 @@
import os
import unittest
+import six
import mock
# pylint: disable=import-error
@@ -150,11 +151,12 @@
self._SetupMocksForGetOperationStatus(
{"error": {"errors": ["error1", "error2"]}},
gcompute_client.OperationScope.GLOBAL)
- self.assertRaisesRegexp(errors.DriverError,
- "Get operation state failed.*error1.*error2",
- self.compute_client._GetOperationStatus,
- {"name": self.OPERATION_NAME},
- gcompute_client.OperationScope.GLOBAL)
+ six.assertRaisesRegex(self,
+ errors.DriverError,
+ "Get operation state failed.*error1.*error2",
+ self.compute_client._GetOperationStatus,
+ {"name": self.OPERATION_NAME},
+ gcompute_client.OperationScope.GLOBAL)
@mock.patch.object(errors, "GceOperationTimeoutError")
@mock.patch.object(utils, "PollAndWait")
@@ -340,7 +342,8 @@
"source": GS_IMAGE_SOURCE_URI,
},
}
- self.assertRaisesRegexp(
+ six.assertRaisesRegex(
+ self,
errors.DriverError,
"Expected fake error",
self.compute_client.CreateImage,
@@ -1082,7 +1085,8 @@
instance=self.INSTANCE, zone=self.ZONE)
self.assertEqual(result, "fake contents")
else:
- self.assertRaisesRegexp(
+ six.assertRaisesRegex(
+ self,
errors.DriverError,
"Malformed response.*",
self.compute_client.GetSerialPortOutput,
@@ -1199,10 +1203,11 @@
"""Test the rsa key path not exists."""
fake_ssh_rsa_path = "/path/to/test_rsa.pub"
self.Patch(os.path, "exists", return_value=False)
- self.assertRaisesRegexp(errors.DriverError,
- "RSA file %s does not exist." % fake_ssh_rsa_path,
- gcompute_client.GetRsaKey,
- ssh_rsa_path=fake_ssh_rsa_path)
+ six.assertRaisesRegex(self,
+ errors.DriverError,
+ "RSA file %s does not exist." % fake_ssh_rsa_path,
+ gcompute_client.GetRsaKey,
+ ssh_rsa_path=fake_ssh_rsa_path)
def testGetRsaKey(self):
"""Test get the rsa key."""