Skip to content

Add flag to allow marking skipped as not 'To Investigate' items #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion reportportal_client/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,24 @@ def uri_join(*uri_parts):
class ReportPortalService(object):
"""Service class with report portal event callbacks."""

def __init__(self, endpoint, project, token, api_base="api/v1"):
def __init__(self, endpoint, project, token, api_base="api/v1",
is_skipped_an_issue=True):
"""Init the service class.

Args:
endpoint: endpoint of report portal service.
project: project name to use for launch names.
token: authorization token.
api_base: defaults to api/v1, can be changed to other version.
is_skipped_an_issue: option to mark skipped tests as not
'To Investigate' items on Server side.
"""
super(ReportPortalService, self).__init__()
self.endpoint = endpoint
self.api_base = api_base
self.project = project
self.token = token
self.is_skipped_an_issue = is_skipped_an_issue
self.base_url = uri_join(self.endpoint,
self.api_base,
self.project)
Expand Down Expand Up @@ -187,6 +191,11 @@ def start_test_item(self, name, start_time, item_type, description=None,
return item_id

def finish_test_item(self, end_time, status, issue=None):
# check if skipped test should not be marked as "TO INVESTIGATE"
if issue is None and status == "SKIPPED" \
and not self.is_skipped_an_issue:
issue = {"issue_type": "NOT_ISSUE"}

data = {
"end_time": end_time,
"status": status,
Expand Down
7 changes: 5 additions & 2 deletions reportportal_client/service_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ class ReportPortalServiceAsync(object):
"""

def __init__(self, endpoint, project, token, api_base="api/v1",
error_handler=None, log_batch_size=20):
error_handler=None, log_batch_size=20,
is_skipped_an_issue=True):
"""Init the service class.

Args:
Expand All @@ -126,12 +127,14 @@ def __init__(self, endpoint, project, token, api_base="api/v1",
api_base: defaults to api/v1, can be changed to other version.
error_handler: function to be called to handle errors occurred
during items processing (in thread)
is_skipped_an_issue: option to mark skipped tests as not
'To Investigate' items on Server side.
"""
super(ReportPortalServiceAsync, self).__init__()
self.error_handler = error_handler
self.log_batch_size = log_batch_size
self.rp_client = ReportPortalService(
endpoint, project, token, api_base)
endpoint, project, token, api_base, is_skipped_an_issue)
self.log_batch = []
self.supported_methods = ["start_launch", "finish_launch",
"start_test_item", "finish_test_item", "log"]
Expand Down