Fix testrail reporter #2
1. Remove status matching from filtering the tests results.
If 'defects' field is not empty - it should be reflected
in results despite the status.
2. Fix for empty plan at posting results.
Change-Id: If21f7f7c421397a9f7616e7e4e1b743bd9b7dd38
diff --git a/tcp_tests/report.py b/tcp_tests/report.py
index f08c933..03530d6 100644
--- a/tcp_tests/report.py
+++ b/tcp_tests/report.py
@@ -113,14 +113,11 @@
def get_results(t_client, run):
- _statuses = ('product_failed', 'failed',
- 'prodfailed', 'blocked')
LOG.info("Get results for run - {}".format(run.name))
results = t_client.results(run)
ret = [(run.id, r) for r in results
if r.raw_data()['status_id'] is not None and
- r.raw_data()['defects'] is not None and
- r.status.name.lower() in _statuses]
+ r.raw_data()['defects'] is not None]
for r in ret:
run_id, result = r
test = fetch_test(result.api, result.raw_data()['test_id'], run_id)
@@ -324,14 +321,15 @@
date=datetime.datetime.now().strftime("%a %b %d %H:%M:%S %Y"),
table=get_md_table(table))
plan = t_client.plan(plan_name)
- plan.description = text
- plan.api._post(
- 'update_plan/{}'.format(plan.id),
- {
- 'name': plan.name,
- 'description': plan.description,
- 'milestone_id': plan.milestone.id
- })
+ if plan:
+ plan.description = text
+ plan.api._post(
+ 'update_plan/{}'.format(plan.id),
+ {
+ 'name': plan.name,
+ 'description': plan.description,
+ 'milestone_id': plan.milestone.id
+ })
def create_report(**kwargs):