aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Broslavsky <serge.broslavsky@linaro.org>2020-10-26 23:15:12 +0200
committerSerge Broslavsky <serge.broslavsky@linaro.org>2020-10-26 23:15:12 +0200
commitfb74d3163d8cf821ea73c2d296cdaac023688a07 (patch)
tree0b0ef43d48f2deb82445a1963961513a8b635705
parentad7f3fbf17ffc40b2d71a79e21c5cc0f9095a43a (diff)
downloadlkft-bucket-fb74d3163d8cf821ea73c2d296cdaac023688a07.tar.gz
wip: report generation
-rw-r--r--stable_report.py47
1 files changed, 36 insertions, 11 deletions
diff --git a/stable_report.py b/stable_report.py
index eef4647..a9a92ac 100644
--- a/stable_report.py
+++ b/stable_report.py
@@ -14,6 +14,10 @@ from requests.compat import urljoin
from squad_client.core.api import SquadApi
from squad_client.core.models import Squad, Project
+import requests_cache
+
+requests_cache.install_cache()
+
"""LKFT Stable Report
Environment variables accepted
@@ -200,7 +204,8 @@ def list_builds(group):
print("{0}: {1}".format(project.slug, project.name))
for build_id, build in builds.items():
build_details_url = urljoin(
- SquadApi.url, "%s/%s/build/%s" % (group.slug, project.slug, build.version)
+ SquadApi.url,
+ "%s/%s/build/%s" % (group.slug, project.slug, build.version),
)
print(
" - {0}: {1} ({2}) {3}".format(
@@ -895,7 +900,11 @@ def dump_object(obj, margin=""):
if type(value) == str:
value = value.replace("\r", "").replace("\n", "↵")
- print("{0} - '{1}': [{2}] '{3}'".format(margin, var_name, type(value).__name__, value))
+ print(
+ "{0} - '{1}': [{2}] '{3}'".format(
+ margin, var_name, type(value).__name__, value
+ )
+ )
if functions:
print("{0} - functions: {1}".format(margin, ", ".join(functions)))
@@ -905,9 +914,9 @@ def debug(group):
print("Project:")
dump_object(project)
suites = project.suites(count=1000)
-
- #print("Suites ({0}):".format(len(suites)))
- #for suite_id, suite in suites.items():
+
+ # print("Suites ({0}):".format(len(suites)))
+ # for suite_id, suite in suites.items():
# print(" - {0} ({1}):".format(suite.slug, suite_id))
# dump_object(suite, " ")
@@ -921,6 +930,8 @@ def debug(group):
testruns = build.testruns(count=1000)
print("\n Test runs ({0}):".format(len(testruns)))
+ project_stats = [0, 0, 0, 0]
+
for testrun_id, testrun in testruns.items():
print("\n - Testrun ({0}):".format(testrun_id))
@@ -949,21 +960,35 @@ def debug(group):
print("\nSuites ({0}):".format(len(suites.keys())))
sorted_suites = []
re_url = re.compile(REGEXP_SUITE_URL)
- breakpoint()
for suite_url, test_count in suites.items():
match = re_url.match(suite_url)
+ # breakpoint()
if not match:
- sorted_suites.append((suite_url, test_count))
+ sorted_suites.append((suite_url, suite_url, test_count))
else:
- sorted_suites.append((project.suite(match.group("id")), test_count))
+ suite = project.suites(id=match.group("id"))
+ if suite:
+ suite = list(suite.values())[0]
+ if suite:
+ sorted_suites.append((suite, suite.slug, test_count))
+ else:
+ sorted_suites.append((suite_url, suite_url, test_count))
+ else:
+ sorted_suites.append((suite_url, suite_url, test_count))
- sorted_suites = sorted(((name, count) for name, count in suites.items()), key=lambda item: item[0])
+ sorted_suites = sorted(
+ ((name, count) for name, _, count in sorted_suites),
+ key=lambda item: item[1]
+ )
for suite, test_count in sorted_suites:
- print(" - {0}: {1} tests".format(suite, test_count))
+ print(" - {0}: {1} tests".format(suite.slug, test_count))
print("\nEnvironments ({0}):".format(len(environments.keys())))
- sorted_environments = sorted(((name, count) for name, count in environments.items()), key=lambda item: item[0])
+ sorted_environments = sorted(
+ ((name, count) for name, count in environments.items()),
+ key=lambda item: item[0],
+ )
for environment, test_count in sorted_environments:
print(" - {0}: {1} tests".format(environment, test_count))