From 79f4f276e2ba57edd6db3d30684c7e142a48201f Mon Sep 17 00:00:00 2001 From: tmarenko Date: Mon, 12 Mar 2018 15:49:02 +0300 Subject: [PATCH 1/3] Force finish (stopping) launch added --- reportportal_client/service.py | 11 +++++++++++ reportportal_client/service_async.py | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/reportportal_client/service.py b/reportportal_client/service.py index 6004c646..c7bbec68 100644 --- a/reportportal_client/service.py +++ b/reportportal_client/service.py @@ -139,6 +139,17 @@ def finish_launch(self, end_time, status=None): logger.debug("finish_launch - Stack: %s", self.stack) return _get_msg(r) + def stop_launch(self, end_time, status=None): + data = { + "end_time": end_time, + "status": status + } + url = uri_join(self.base_url, "launch", self.launch_id, "stop") + r = self.session.put(url=url, json=data) + self.stack.pop() + logger.debug("stop_launch - Stack: %s", self.stack) + return _get_msg(r) + def start_test_item(self, name, start_time, item_type, description=None, tags=None): """ diff --git a/reportportal_client/service_async.py b/reportportal_client/service_async.py index d8c71aae..9ed8107b 100644 --- a/reportportal_client/service_async.py +++ b/reportportal_client/service_async.py @@ -232,6 +232,15 @@ def finish_launch(self, end_time, status=None): } self.queue.put_nowait(("finish_launch", args)) + def stop_launch(self, end_time, status=None): + logger.debug("Stop launch queued") + + args = { + "end_time": end_time, + "status": status + } + self.queue.put_nowait(("stop_launch", args)) + def start_test_item(self, name, start_time, item_type, description=None, tags=None): logger.debug("start_test_item queued") From a0c3d94b3625d1ac922faf2830ea4669a89d1088 Mon Sep 17 00:00:00 2001 From: tmarenko Date: Wed, 14 Mar 2018 08:05:48 +0300 Subject: [PATCH 2/3] Bump up version to 3.1.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 91cff80f..8736b5fd 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='reportportal-client', packages=find_packages(), - version='3.0.0', + version='3.1.0', description='Python client for Report Portal', author='Artsiom Tkachou', author_email='SupportEPMC-TSTReportPortal@epam.com', From bc62769c5e525e4d0c47172397010b93bab64bb4 Mon Sep 17 00:00:00 2001 From: tmarenko Date: Wed, 14 Mar 2018 13:41:03 +0300 Subject: [PATCH 3/3] Finalizing launch with less copypaste --- reportportal_client/service.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/reportportal_client/service.py b/reportportal_client/service.py index c7bbec68..5652dffb 100644 --- a/reportportal_client/service.py +++ b/reportportal_client/service.py @@ -128,27 +128,24 @@ def start_launch(self, name, start_time, description=None, tags=None, logger.debug("start_launch - Stack: %s", self.stack) return self.launch_id - def finish_launch(self, end_time, status=None): + def _finalize_launch(self, end_time, action, status): data = { "end_time": end_time, "status": status } - url = uri_join(self.base_url, "launch", self.launch_id, "finish") + url = uri_join(self.base_url, "launch", self.launch_id, action) r = self.session.put(url=url, json=data) self.stack.pop() - logger.debug("finish_launch - Stack: %s", self.stack) + logger.debug("%s_launch - Stack: %s", action, self.stack) return _get_msg(r) + def finish_launch(self, end_time, status=None): + return self._finalize_launch(end_time=end_time, action="finish", + status=status) + def stop_launch(self, end_time, status=None): - data = { - "end_time": end_time, - "status": status - } - url = uri_join(self.base_url, "launch", self.launch_id, "stop") - r = self.session.put(url=url, json=data) - self.stack.pop() - logger.debug("stop_launch - Stack: %s", self.stack) - return _get_msg(r) + return self._finalize_launch(end_time=end_time, action="stop", + status=status) def start_test_item(self, name, start_time, item_type, description=None, tags=None):