Fix tox issue 57/99457/1
authorBin Yang <bin.yang@windriver.com>
Wed, 11 Dec 2019 05:39:21 +0000 (05:39 +0000)
committerBin Yang <bin.yang@windriver.com>
Wed, 11 Dec 2019 05:39:21 +0000 (05:39 +0000)
set basepython 2.7 for all tox test

Change-Id: Ie607a6c6780790c26311bed3fb940b5892d375e6
Issue-ID: MULTICLOUD-963
Signed-off-by: Bin Yang <bin.yang@windriver.com>
azure/multicloud_azure/pub/utils/fileutil.py
azure/multicloud_azure/pub/utils/restcall.py
azure/multicloud_azure/swagger/views/flavor/views.py
azure/multicloud_azure/tests/test_pub_utils.py
azure/tox.ini

index 1868300..8449322 100644 (file)
@@ -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):
index 0b0ef33..81f4139 100644 (file)
@@ -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())
index c4eb060..8b65cea 100644 (file)
@@ -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)
 
index 1e08e9b..784013b 100644 (file)
@@ -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"
index 58fd7a6..bae09d9 100644 (file)
@@ -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