From c883810963b208e60b714e2c222b32f20bd6138a Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Wed, 17 May 2017 06:06:51 +0200 Subject: Add Python3 support to the ODL testcase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It also adds this support to its dependencies. Change-Id: I0534f0c7b0e15a9ee89f522f314cf5200874454c Signed-off-by: Cédric Ollivier --- functest/utils/functest_utils.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'functest/utils/functest_utils.py') diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py index 3e85b9e46..6be3883fa 100644 --- a/functest/utils/functest_utils.py +++ b/functest/utils/functest_utils.py @@ -16,11 +16,11 @@ import shutil import subprocess import sys import time -import urllib2 from datetime import datetime as dt import dns.resolver import requests +from six.moves import urllib import yaml from git import Repo @@ -39,9 +39,9 @@ def check_internet_connectivity(url='http://www.opnfv.org/'): Check if there is access to the internet """ try: - urllib2.urlopen(url, timeout=5) + urllib.request.urlopen(url, timeout=5) return True - except urllib2.URLError: + except urllib.error.URLError: return False @@ -52,8 +52,8 @@ def download_url(url, dest_path): name = url.rsplit('/')[-1] dest = dest_path + "/" + name try: - response = urllib2.urlopen(url) - except (urllib2.HTTPError, urllib2.URLError): + response = urllib.request.urlopen(url) + except (urllib.error.HTTPError, urllib.error.URLError): return False with open(dest, 'wb') as f: @@ -318,7 +318,7 @@ def execute_command(cmd, info=False, error_msg="", f.write(line) else: line = line.replace('\n', '') - print line + print(line) sys.stdout.flush() if output_file: f.close() -- cgit 1.2.3-korg