from collections import defaultdict
from itertools import chain
-import requests
import traceback
-import warnings
import docutils.core
import jinja2
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"),
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"]
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"):
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",
[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