[VVP] Removing dynamic download of needs.json 36/77536/3
authorLovett, Trevor <trevor.lovett@att.com>
Tue, 29 Jan 2019 20:14:44 +0000 (14:14 -0600)
committerLovett, Trevor <trevor.lovett@att.com>
Tue, 29 Jan 2019 20:43:23 +0000 (14:43 -0600)
Also resolving some flake8 failures

Change-Id: I2de20975106de0308bc20c2a8944e3552f6f7cca
Issue-ID: VVP-140
Signed-off-by: Lovett, Trevor <trevor.lovett@att.com>
ice_validator/tests/conftest.py
ice_validator/vvp.py
tox.ini

index 5621354..1a47e63 100644 (file)
@@ -47,9 +47,7 @@ import time
 from collections import defaultdict
 from itertools import chain
 
-import requests
 import traceback
-import warnings
 
 import docutils.core
 import jinja2
@@ -65,10 +63,7 @@ __path__ = [os.path.dirname(os.path.abspath(__file__))]
 DEFAULT_OUTPUT_DIR = "{}/../output".format(__path__[0])
 
 RESOLUTION_STEPS_FILE = "resolution_steps.json"
-HEAT_REQUIREMENTS_FILE = "heat_requirements.json"
-
-# noinspection PyPep8
-NEEDS_JSON_URL = "https://onap.readthedocs.io/en/latest/_downloads/789ac64d223325488fb3f120f959d985/needs.json"
+HEAT_REQUIREMENTS_FILE = os.path.join(__path__[0], "..", "heat_requirements.json")
 
 REPORT_COLUMNS = [
     ("Input File", "file"),
@@ -1012,23 +1007,6 @@ def hash_directory(path):
 
 def load_current_requirements():
     """Loads dict of current requirements or empty dict if file doesn't exist"""
-    try:
-        r = requests.get(NEEDS_JSON_URL)
-        if r.headers.get("content-type") == "application/json":
-            with open(HEAT_REQUIREMENTS_FILE, "wb") as needs:
-                needs.write(r.content)
-        else:
-            warnings.warn(
-                (
-                    "Unexpected content-type ({}) encountered downloading "
-                    + "requirements.json, using last saved copy"
-                ).format(r.headers.get("content-type"))
-            )
-    except requests.exceptions.RequestException as e:
-        warnings.warn("Error downloading latest JSON, using last saved copy.")
-        warnings.warn(UserWarning(e))
-    if not os.path.exists(HEAT_REQUIREMENTS_FILE):
-        return {}
     with io.open(HEAT_REQUIREMENTS_FILE, encoding="utf8", mode="r") as f:
         data = json.load(f)
         version = data["current_version"]
index 9c63168..8d1fc69 100644 (file)
@@ -185,7 +185,7 @@ class QueueWriter:
 
 
 def get_plugins() -> Optional[List]:
-    """When running in a frozen bundle, plugins need to be registered
+    """When running in a frozen bundle, plugins to be registered
     explicitly. This method will return the required plugins to register
     based on the run mode"""
     if hasattr(sys, "frozen"):
@@ -682,7 +682,7 @@ class ValidatorApp:
         try:
             os.remove(self.report_file_path)
             return True
-        except OSError as e:
+        except OSError:
             messagebox.showerror(
                 "Error",
                 "Please close or rename the open report file before re-validating",
diff --git a/tox.ini b/tox.ini
index 34ba2cd..305378c 100644 (file)
--- a/tox.ini
+++ b/tox.ini
 
 [tox]
 skipsdist=True
-envlist = py36,style
+envlist = py36
 
 [testenv]
 distribute = False
-basepython = python3.6
 commands =
    {envpython} --version
     pytest --version
     coverage run --module pytest ice_validator/tests --self-test -rxXs
     coverage xml
+    flake8 --version
+    flake8 ice_validator
 deps = --no-use-pep517 
     -rrequirements.txt
-    flake8==3.4.1
+    flake8==3.6.0
     coverage==4.5.1
 
-[testenv:style]
-commands = flake8 ice_validator
-
-[testenv:py36]
-basepython=python3.6
 
 [flake8]
 ignore = W391, W503, E501