Use print function rather than statement in tests

Python3 does not support the print statement, only the print function.
Whereas Python 2.6 and 2.7 support both.

Until statement is used, executing pylint via python3 on these files
causes error.

There is no more old way print in trove repository.

Change-Id: I063eb9dd7e690ac2cdc92810982c7f9a6ae22388
Signed-off-by: Marcin Piwowarczyk <m.piwowarczy@samsung.com>
This commit is contained in:
Marcin Piwowarczyk 2018-08-21 16:00:50 +02:00 committed by Marcin PIwowarczyk
parent 651b4836bf
commit caf2cb734c
3 changed files with 14 additions and 14 deletions

View File

@ -46,11 +46,11 @@ class ConfigFile(object):
auth_id = self.tenant auth_id = self.tenant
tenant_id = self.tenant tenant_id = self.tenant
print "id = %s" % auth_id print("id = %s" % auth_id)
self.headers = { self.headers = {
'X-Auth-Token': str(auth_id) 'X-Auth-Token': str(auth_id)
} }
print "tenantID = %s" % tenant_id print("tenantID = %s" % tenant_id)
self.tenantID = tenant_id self.tenantID = tenant_id
self.dbaas_url = "%s/v1.0/%s" % (self.api_url, self.tenantID) self.dbaas_url = "%s/v1.0/%s" % (self.api_url, self.tenantID)

View File

@ -43,19 +43,19 @@ class ExampleClient(object):
self.directory = config.get("directory", None) self.directory = config.get("directory", None)
if not self.directory.endswith('/'): if not self.directory.endswith('/'):
self.directory += '/' self.directory += '/'
print "directory = %s" % self.directory print("directory = %s" % self.directory)
self.api_url = config.get("api_url", None) self.api_url = config.get("api_url", None)
print "api_url = %s" % self.api_url print("api_url = %s" % self.api_url)
#auth #auth
auth_url = config.get("auth_url", None) auth_url = config.get("auth_url", None)
print "auth_url = %s" % auth_url print("auth_url = %s" % auth_url)
username = config.get("username", None) username = config.get("username", None)
print "username = %s" % username print("username = %s" % username)
password = config.get("password", None) password = config.get("password", None)
print "password = %s" % password print("password = %s" % password)
self.tenant = config.get("tenant", None) self.tenant = config.get("tenant", None)
self.replace_host = config.get("replace_host", None) self.replace_host = config.get("replace_host", None)
print "tenant = %s" % self.tenant print("tenant = %s" % self.tenant)
self.replace_dns_hostname = config.get("replace_dns_hostname", None) self.replace_dns_hostname = config.get("replace_dns_hostname", None)
if auth_url: if auth_url:
auth_id, tenant_id = self.get_auth_token_id_tenant_id(auth_url, auth_id, tenant_id = self.get_auth_token_id_tenant_id(auth_url,
@ -65,11 +65,11 @@ class ExampleClient(object):
auth_id = self.tenant auth_id = self.tenant
tenant_id = self.tenant tenant_id = self.tenant
print "id = %s" % auth_id print("id = %s" % auth_id)
self.headers = { self.headers = {
'X-Auth-Token': str(auth_id) 'X-Auth-Token': str(auth_id)
} }
print "tenantID = %s" % tenant_id print("tenantID = %s" % tenant_id)
self.tenantID = tenant_id self.tenantID = tenant_id
self.dbaas_url = "%s/v1.0/%s" % (self.api_url, self.tenantID) self.dbaas_url = "%s/v1.0/%s" % (self.api_url, self.tenantID)
@ -123,7 +123,7 @@ class ExampleClient(object):
def make_request(self, name, method, json, xml, def make_request(self, name, method, json, xml,
output=True, print_resp=False): output=True, print_resp=False):
name = name.replace('_', '-') name = name.replace('_', '-')
print "http call for %s" % name print("http call for %s" % name)
http = httplib2.Http(disable_ssl_certificate_validation=True) http = httplib2.Http(disable_ssl_certificate_validation=True)
req_headers = {'User-Agent': "python-example-client", req_headers = {'User-Agent': "python-example-client",
'Content-Type': "application/json", 'Content-Type': "application/json",

View File

@ -44,7 +44,7 @@ class InstanceStatusTests(object):
lambda instance: instance.status == 'ERROR', lambda instance: instance.status == 'ERROR',
time_out=10) time_out=10)
instance = self.dbaas.instances.get(response.id) instance = self.dbaas.instances.get(response.id)
print "Status: %s" % instance.status print("Status: %s" % instance.status)
assert_equal(instance.status, "ERROR", assert_equal(instance.status, "ERROR",
"Instance did not drop to error after volume prov failure.") "Instance did not drop to error after volume prov failure.")
@ -57,7 +57,7 @@ class InstanceStatusTests(object):
lambda instance: instance.status == 'ERROR', lambda instance: instance.status == 'ERROR',
time_out=10) time_out=10)
instance = self.dbaas.instances.get(response.id) instance = self.dbaas.instances.get(response.id)
print "Status: %s" % instance.status print("Status: %s" % instance.status)
assert_equal(instance.status, "ERROR", assert_equal(instance.status, "ERROR",
"Instance did not drop to error after server prov failure.") "Instance did not drop to error after server prov failure.")
@ -71,6 +71,6 @@ class InstanceStatusTests(object):
lambda instance: instance.status == 'ERROR', lambda instance: instance.status == 'ERROR',
time_out=10) time_out=10)
instance = self.dbaas.instances.get(response.id) instance = self.dbaas.instances.get(response.id)
print "Status: %s" % instance.status print("Status: %s" % instance.status)
assert_equal(instance.status, "ERROR", assert_equal(instance.status, "ERROR",
"Instance did not drop to error after DNS prov failure.") "Instance did not drop to error after DNS prov failure.")