Skip to content

Commit 969348f

Browse files
author
Avishay Machluf
committed
Add flag to allow marking skipped as not 'To Investigate' items
Add is_skipped_an_issue flag to services to allow uploading skipped tests items as not 'To Investigate' items on Server side.
1 parent b8a4c4b commit 969348f

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

reportportal_client/service.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,24 @@ def uri_join(*uri_parts):
8686
class ReportPortalService(object):
8787
"""Service class with report portal event callbacks."""
8888

89-
def __init__(self, endpoint, project, token, api_base="api/v1"):
89+
def __init__(self, endpoint, project, token, api_base="api/v1",
90+
is_skipped_an_issue=True):
9091
"""Init the service class.
9192
9293
Args:
9394
endpoint: endpoint of report portal service.
9495
project: project name to use for launch names.
9596
token: authorization token.
9697
api_base: defaults to api/v1, can be changed to other version.
98+
is_skipped_an_issue: option to mark skipped tests as not
99+
'To Investigate' items on Server side.
97100
"""
98101
super(ReportPortalService, self).__init__()
99102
self.endpoint = endpoint
100103
self.api_base = api_base
101104
self.project = project
102105
self.token = token
106+
self.is_skipped_an_issue = is_skipped_an_issue
103107
self.base_url = uri_join(self.endpoint,
104108
self.api_base,
105109
self.project)
@@ -187,6 +191,11 @@ def start_test_item(self, name, start_time, item_type, description=None,
187191
return item_id
188192

189193
def finish_test_item(self, end_time, status, issue=None):
194+
# check if skipped test should not be marked as "TO INVESTIGATE"
195+
if issue is None and status == "SKIPPED" \
196+
and not self.is_skipped_an_issue:
197+
issue = {"issue_type": "NOT_ISSUE"}
198+
190199
data = {
191200
"end_time": end_time,
192201
"status": status,

reportportal_client/service_async.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ class ReportPortalServiceAsync(object):
116116
"""
117117

118118
def __init__(self, endpoint, project, token, api_base="api/v1",
119-
error_handler=None, log_batch_size=20):
119+
error_handler=None, log_batch_size=20,
120+
is_skipped_an_issue=True):
120121
"""Init the service class.
121122
122123
Args:
@@ -126,12 +127,14 @@ def __init__(self, endpoint, project, token, api_base="api/v1",
126127
api_base: defaults to api/v1, can be changed to other version.
127128
error_handler: function to be called to handle errors occurred
128129
during items processing (in thread)
130+
is_skipped_an_issue: option to mark skipped tests as not
131+
'To Investigate' items on Server side.
129132
"""
130133
super(ReportPortalServiceAsync, self).__init__()
131134
self.error_handler = error_handler
132135
self.log_batch_size = log_batch_size
133136
self.rp_client = ReportPortalService(
134-
endpoint, project, token, api_base)
137+
endpoint, project, token, api_base, is_skipped_an_issue)
135138
self.log_batch = []
136139
self.supported_methods = ["start_launch", "finish_launch",
137140
"start_test_item", "finish_test_item", "log"]

0 commit comments

Comments
 (0)