Adapt dataservices-api server to python3
Related to https://github.com/CartoDB/cartodb-platform/issues/6237
This commit is contained in:
@@ -20,7 +20,7 @@ class ImportHelper:
|
||||
response.raise_for_status()
|
||||
response_json = json.loads(response.text)
|
||||
if not response_json['success']:
|
||||
print "Error importing the test dataset: {0}".format(response.text)
|
||||
print("Error importing the test dataset: {0}".format(response.text))
|
||||
sys.exit(1)
|
||||
while(True):
|
||||
table_name = ImportHelper.get_imported_table_name(
|
||||
@@ -42,8 +42,8 @@ class ImportHelper:
|
||||
schema, username, host, import_id, api_key)
|
||||
import_data_response = requests.get(import_url)
|
||||
if import_data_response.status_code != 200:
|
||||
print "Error getting the table name from " \
|
||||
"the import data: {0}".format(import_data_response.text)
|
||||
print("Error getting the table name from " \
|
||||
"the import data: {0}".format(import_data_response.text))
|
||||
sys.exit(1)
|
||||
import_data_json = json.loads(import_data_response.text)
|
||||
|
||||
@@ -57,5 +57,5 @@ class ImportHelper:
|
||||
)
|
||||
response = requests.get(url)
|
||||
if response.status_code != 200:
|
||||
print "Error cleaning the test dataset: {0}".format(response.text)
|
||||
print("Error cleaning the test dataset: {0}".format(response.text))
|
||||
sys.exit(1)
|
||||
|
||||
@@ -48,7 +48,7 @@ class IntegrationTestHelper:
|
||||
def execute_query_raw(cls, sql_api_url, query):
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
query_url = "{0}?q={1}".format(sql_api_url, query)
|
||||
print "Executing query: {0}".format(query_url)
|
||||
print("Executing query: {0}".format(query_url))
|
||||
query_response = requests.get(query_url)
|
||||
if query_response.status_code != 200:
|
||||
raise Exception(json.loads(query_response.text)['error'])
|
||||
|
||||
@@ -36,7 +36,7 @@ def main():
|
||||
set_environment_variables(username, api_key, table_name, host, schema)
|
||||
execute_tests()
|
||||
except Exception as e:
|
||||
print e.message
|
||||
print(e)
|
||||
sys.exit(1)
|
||||
finally:
|
||||
clean_environment_variables()
|
||||
@@ -45,11 +45,11 @@ def main():
|
||||
|
||||
|
||||
def usage():
|
||||
print """Usage: run_tests.py [options] username api_key
|
||||
print("""Usage: run_tests.py [options] username api_key
|
||||
Options:
|
||||
-h: Show this help
|
||||
--host: take that host as base (by default is cartodb.com)
|
||||
--schema: define the url schema [http/https] (by default https)"""
|
||||
--schema: define the url schema [http/https] (by default https)""")
|
||||
|
||||
|
||||
def execute_tests():
|
||||
@@ -59,7 +59,7 @@ def execute_tests():
|
||||
stderr=subprocess.PIPE
|
||||
)
|
||||
out, err = process.communicate()
|
||||
print err
|
||||
print(err)
|
||||
regexp = re.compile(r'FAILED \(.*\)')
|
||||
if regexp.search(err) is not None:
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user