fix flake8 tests
Change-Id: I1d02afb4c6372e761913e45f44da143dcf0eb993
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
diff --git a/osm_nbi/engine.py b/osm_nbi/engine.py
index ed35c7c..c13240d 100644
--- a/osm_nbi/engine.py
+++ b/osm_nbi/engine.py
@@ -857,8 +857,8 @@
return folder_content, "text/plain"
# TODO manage folders in http
else:
- return self.fs.file_open((storage['folder'], storage['pkg-dir'], *path), "rb"), \
- "application/octet-stream"
+ return self.fs.file_open((storage['folder'], storage['pkg-dir'], *path), "rb"),\
+ "application/octet-stream"
# pkgtype accept ZIP TEXT -> result
# manyfiles yes X -> zip
diff --git a/osm_nbi/nbi.py b/osm_nbi/nbi.py
index a0229c8..ff8cd11 100644
--- a/osm_nbi/nbi.py
+++ b/osm_nbi/nbi.py
@@ -257,7 +257,7 @@
try:
user_passwd = standard_b64decode(user_passwd64).decode()
user, _, passwd = user_passwd.partition(":")
- except:
+ except Exception:
pass
outdata = self.engine.new_token(None, {"username": user, "password": passwd})
token = outdata["id"]
@@ -323,15 +323,15 @@
elif format_yaml:
try:
kwargs[k] = yaml.load(v)
- except:
+ except Exception:
pass
elif k.endswith(".gt") or k.endswith(".lt") or k.endswith(".gte") or k.endswith(".lte"):
try:
kwargs[k] = int(v)
- except:
+ except Exception:
try:
kwargs[k] = float(v)
- except:
+ except Exception:
pass
elif v.find(",") > 0:
kwargs[k] = v.split(",")
@@ -342,7 +342,7 @@
elif format_yaml:
try:
v[index] = yaml.load(v[index])
- except:
+ except Exception:
pass
return indata
@@ -449,7 +449,7 @@
elif method == "POST":
try:
session = self._authorization()
- except:
+ except Exception:
session = None
if kwargs:
indata.update(kwargs)
@@ -488,7 +488,7 @@
thread_info = None
if args and args[0] == "help":
return "<html><pre>\ninit\nfile/<name> download file\ndb-clear/table\nprune\nlogin\nlogin2\n"\
- "sleep/<time>\nmessage/topic\n</pre></html>"
+ "sleep/<time>\nmessage/topic\n</pre></html>"
elif args and args[0] == "init":
try:
@@ -787,7 +787,7 @@
for k, v in environ.items():
if not k.startswith("OSMNBI_"):
continue
- k1, _, k2 = k[7:].lower().partition("_")
+ k1, _, k2 = k[7:].lower().partition("_")
if not k2:
continue
try:
diff --git a/osm_nbi/test/cirros_ns/cirros_nsd.yaml b/osm_nbi/tests/cirros_ns/cirros_nsd.yaml
similarity index 100%
rename from osm_nbi/test/cirros_ns/cirros_nsd.yaml
rename to osm_nbi/tests/cirros_ns/cirros_nsd.yaml
diff --git a/osm_nbi/test/cirros_ns/icons/osm_2x.png b/osm_nbi/tests/cirros_ns/icons/osm_2x.png
similarity index 100%
rename from osm_nbi/test/cirros_ns/icons/osm_2x.png
rename to osm_nbi/tests/cirros_ns/icons/osm_2x.png
Binary files differ
diff --git a/osm_nbi/test/cirros_vnf/cirros_vnfd.yaml b/osm_nbi/tests/cirros_vnf/cirros_vnfd.yaml
similarity index 100%
rename from osm_nbi/test/cirros_vnf/cirros_vnfd.yaml
rename to osm_nbi/tests/cirros_vnf/cirros_vnfd.yaml
diff --git a/osm_nbi/test/cirros_vnf/icons/cirros-64.png b/osm_nbi/tests/cirros_vnf/icons/cirros-64.png
similarity index 100%
rename from osm_nbi/test/cirros_vnf/icons/cirros-64.png
rename to osm_nbi/tests/cirros_vnf/icons/cirros-64.png
Binary files differ
diff --git a/osm_nbi/test/create-ping-pong.sh b/osm_nbi/tests/create-ping-pong.sh
similarity index 100%
rename from osm_nbi/test/create-ping-pong.sh
rename to osm_nbi/tests/create-ping-pong.sh
diff --git a/osm_nbi/test/delete-all.sh b/osm_nbi/tests/delete-all.sh
similarity index 100%
rename from osm_nbi/test/delete-all.sh
rename to osm_nbi/tests/delete-all.sh
diff --git a/osm_nbi/test/test.py b/osm_nbi/tests/test.py
similarity index 100%
rename from osm_nbi/test/test.py
rename to osm_nbi/tests/test.py
diff --git a/osm_nbi/test/upload.py b/osm_nbi/tests/upload.py
similarity index 100%
rename from osm_nbi/test/upload.py
rename to osm_nbi/tests/upload.py
diff --git a/tox.ini b/tox.ini
index dd134c1..46d478b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -11,7 +11,7 @@
basepython = python3
deps = flake8
commands =
- flake8 setup.py --max-line-length 120 --exclude .svn,CVS,.gz,.git,__pycache__,.tox,local,temp --ignore W291,W293
+ flake8 osm_nbi --max-line-length 120 --exclude .svn,CVS,.gz,.git,__pycache__,.tox,local,temp,vnfd_catalog.py,nsd_catalog.py --ignore W291,W293,E226
[testenv:build]
basepython = python3