aboutsummaryrefslogtreecommitdiffstats
path: root/checks.py
diff options
context:
space:
mode:
authorLovett, Trevor <trevor.lovett@att.com>2019-09-19 16:37:29 -0500
committerLovett, Trevor (tl2972) <tl2972@att.com>2019-09-19 16:37:53 -0500
commitbe181843f2517de647f9dc1b9188b69186051aa6 (patch)
tree5c67fe85bb2ff4b8b62a99351ef05204fd61a0f7 /checks.py
parentff44cf54a9661597443f4f0a9ae9c5328aa4f22e (diff)
[VVP] Removed additional f-string for build-upload issue
Also made heat req't json and req't mapping optional in checks.py Change-Id: I38367e768de704cca3727bccb8f8bcdb04f9b193 Issue-ID: VVP-311 Signed-off-by: Lovett, Trevor <trevor.lovett@att.com>
Diffstat (limited to 'checks.py')
-rw-r--r--checks.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/checks.py b/checks.py
index 4e5fb13..9f8740a 100644
--- a/checks.py
+++ b/checks.py
@@ -82,7 +82,7 @@ class Traceability:
"""
testable_mappings = [m for m in self.mappings if m[self.IS_TESTABLE] == "True"]
return [
- f"Missing test for {m[self.REQ_ID]}"
+ f"WARN: Missing test for {m[self.REQ_ID]}"
for m in testable_mappings
if not m[self.TEST_NAME]
]
@@ -137,22 +137,20 @@ def check_requirements_up_to_date():
"""
Checks if the requirements file packaged with VVP has meaningful differences
to the requirements file published from VNFRQTS.
- :return: list of errors found
"""
- msg = ["heat_requirements.json is out-of-date. Run update_reqs.py to update."]
+ msg = "WARN: heat_requirements.json is out-of-date. Run update_reqs.py to update."
latest_needs = json.load(get_requirements())
with open(CURRENT_NEEDS_PATH, "r") as f:
current_needs = json.load(f)
latest_reqs = select_items(in_scope, current_version(latest_needs))
current_reqs = select_items(in_scope, current_version(current_needs))
if set(latest_reqs.keys()) != set(current_reqs.keys()):
- return msg
- if not all(
+ print(msg)
+ elif not all(
latest["description"] == current_reqs[r_id]["description"]
for r_id, latest in latest_reqs.items()
):
- return msg
- return None
+ print(msg)
def check_app_tests_pass():
@@ -173,7 +171,7 @@ def check_self_test_pass():
def check_testable_requirements_are_mapped():
tracing = Traceability()
- return tracing.unmapped_requirement_errors()
+ print("\n".join(tracing.unmapped_requirement_errors()))
def check_non_testable_requirements_are_not_mapped():
@@ -199,14 +197,15 @@ def check_bandit_passes():
stderr=subprocess.PIPE, # nosec
) # nosec
msgs = result.stdout.split("\n") if result.returncode != 0 else []
- return ["bandit errors detected:"] + [f" {e}" for e in msgs] if msgs else []
+ return (
+ ["bandit errors detected:"] + [" {}".format(e) for e in msgs] if msgs else []
+ )
if __name__ == "__main__":
+
checks = [
check_self_test_pass,
- check_requirements_up_to_date,
- check_testable_requirements_are_mapped,
check_non_testable_requirements_are_not_mapped,
check_flake8_passes,
check_bandit_passes,
@@ -214,4 +213,6 @@ if __name__ == "__main__":
results = [check() for check in checks]
errors = "\n".join("\n".join(msg) for msg in results if msg)
print(errors or "Everything looks good!")
+ check_requirements_up_to_date()
+ check_testable_requirements_are_mapped()
sys.exit(1 if errors else 0)