summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2019-12-11 05:39:21 +0000
committerBin Yang <bin.yang@windriver.com>2019-12-11 05:39:21 +0000
commit03386aae18234fcf70b29d80e3ac577791a90dd0 (patch)
treed789eae1d1ac0baacc6426a2280ca0de2f34b018
parent61d7d474895188ba05ed484c0550babb5f23451e (diff)
Fix tox issue
set basepython 2.7 for all tox test Change-Id: Ie607a6c6780790c26311bed3fb940b5892d375e6 Issue-ID: MULTICLOUD-963 Signed-off-by: Bin Yang <bin.yang@windriver.com>
-rw-r--r--azure/multicloud_azure/pub/utils/fileutil.py2
-rw-r--r--azure/multicloud_azure/pub/utils/restcall.py2
-rw-r--r--azure/multicloud_azure/swagger/views/flavor/views.py2
-rw-r--r--azure/multicloud_azure/tests/test_pub_utils.py2
-rw-r--r--azure/tox.ini8
5 files changed, 10 insertions, 6 deletions
diff --git a/azure/multicloud_azure/pub/utils/fileutil.py b/azure/multicloud_azure/pub/utils/fileutil.py
index 1868300..8449322 100644
--- a/azure/multicloud_azure/pub/utils/fileutil.py
+++ b/azure/multicloud_azure/pub/utils/fileutil.py
@@ -20,7 +20,7 @@ logger = logging.getLogger(__name__)
def make_dirs(path):
if not os.path.exists(path):
- os.makedirs(path, 0777)
+ os.makedirs(path, 0o777)
def delete_dirs(path):
diff --git a/azure/multicloud_azure/pub/utils/restcall.py b/azure/multicloud_azure/pub/utils/restcall.py
index 0b0ef33..81f4139 100644
--- a/azure/multicloud_azure/pub/utils/restcall.py
+++ b/azure/multicloud_azure/pub/utils/restcall.py
@@ -86,7 +86,7 @@ def call_req(base_url, user, passwd, auth_type, resource, method, content='',
raise ex
except urllib2.URLError as err:
ret = [2, str(err), resp_status, resp]
- except Exception as ex:
+ except Exception:
logger.error(traceback.format_exc())
logger.error("[%s]ret=%s" % (callid, str(sys.exc_info())))
res_info = str(sys.exc_info())
diff --git a/azure/multicloud_azure/swagger/views/flavor/views.py b/azure/multicloud_azure/swagger/views/flavor/views.py
index c4eb060..8b65cea 100644
--- a/azure/multicloud_azure/swagger/views/flavor/views.py
+++ b/azure/multicloud_azure/swagger/views/flavor/views.py
@@ -27,7 +27,7 @@ class FlavorsView(APIView):
def post(self, request, vimid):
try:
create_req = json.loads(request.body)
- except Exception as e:
+ except Exception:
return Response(data={'error': 'Fail to decode request body.'},
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
diff --git a/azure/multicloud_azure/tests/test_pub_utils.py b/azure/multicloud_azure/tests/test_pub_utils.py
index 1e08e9b..784013b 100644
--- a/azure/multicloud_azure/tests/test_pub_utils.py
+++ b/azure/multicloud_azure/tests/test_pub_utils.py
@@ -46,7 +46,7 @@ class TestPub(unittest.TestCase):
def test_make_dirs(self):
path = "/tmp/azure/azure/bin"
- self.assertEqual(os.makedirs(path, 0777), make_dirs(path))
+ self.assertEqual(os.makedirs(path, 0o777), make_dirs(path))
def test_delete_dirs(self):
path = "/tmp/azure/azure/bin"
diff --git a/azure/tox.ini b/azure/tox.ini
index 58fd7a6..bae09d9 100644
--- a/azure/tox.ini
+++ b/azure/tox.ini
@@ -1,11 +1,15 @@
[tox]
-envlist = py27,pep8
+envlist = py27,pep8, cover
skipsdist = true
[tox:jenkins]
downloadcache = ~/cache/pip
[testenv]
+basepython =
+ py27: python2.7
+ pep8: python2.7
+ cover: python2.7
deps =
-r{toxinidir}/requirements.txt
commands =
@@ -28,4 +32,4 @@ setenv=
commands =
coverage erase
{[testenv]commands}
- coverage xml -i \ No newline at end of file
+ coverage xml -i