@@ -98,6 +98,8 @@ def __init__(self,
9898 self .log_batch_payload_size = log_batch_payload_size
9999 self .token = token
100100 self .verify_ssl = verify_ssl
101+ self .retries = retries
102+ self .max_pool_size = max_pool_size
101103 self .http_timeout = http_timeout
102104 self .session = requests .Session ()
103105 self .step_reporter = StepReporter (self )
@@ -167,7 +169,7 @@ def finish_test_item(self,
167169 """Finish suite/case/step/nested step item.
168170
169171 :param item_id: ID of the test item
170- :param end_time: Test item end time
172+ :param end_time: The item end time
171173 :param status: Test status. Allowable values: "passed",
172174 "failed", "stopped", "skipped", "interrupted",
173175 "cancelled" or None
@@ -197,7 +199,6 @@ def finish_test_item(self,
197199 verify_ssl = self .verify_ssl ).make ()
198200 if not response :
199201 return
200- # noinspection PyUnresolvedReferences
201202 self ._item_stack .pop () if len (self ._item_stack ) > 0 else None
202203 logger .debug ('finish_test_item - ID: %s' , item_id )
203204 logger .debug ('response message: %s' , response .message )
@@ -281,9 +282,9 @@ def log(self, time, message, level=None, attachment=None, item_id=None):
281282 """Send log message to the Report Portal.
282283
283284 :param time: Time in UTC
284- :param message: Log message
285+ :param message: Log message text
285286 :param level: Message's log level
286- :param attachment: Message attachments
287+ :param attachment: Message's attachments
287288 :param item_id: ID of the RP item the message belongs to
288289 """
289290 self ._log_manager .log (time , message , level , attachment , item_id )
@@ -370,7 +371,7 @@ def start_test_item(self,
370371 """Start case/step/nested step item.
371372
372373 :param name: Name of the test item
373- :param start_time: Test item start time
374+ :param start_time: The item start time
374375 :param item_type: Type of the test item. Allowable values:
375376 "suite", "story", "test", "scenario", "step",
376377 "before_class", "before_groups",
@@ -379,7 +380,7 @@ def start_test_item(self,
379380 "after_method", "after_suite", "after_test"
380381 :param attributes: Test item attributes
381382 :param code_ref: Physical location of the test item
382- :param description: Test item description
383+ :param description: The item description
383384 :param has_stats: Set to False if test item is nested step
384385 :param parameters: Set of parameters (for parametrized test items)
385386 :param parent_item_id: An ID of a parent SUITE / STEP
@@ -418,7 +419,6 @@ def start_test_item(self,
418419 item_id = response .id
419420 if item_id is not NOT_FOUND :
420421 logger .debug ('start_test_item - ID: %s' , item_id )
421- # noinspection PyUnresolvedReferences
422422 self ._item_stack .append (item_id )
423423 else :
424424 logger .warning ('start_test_item - invalid response: %s' ,
@@ -452,5 +452,29 @@ def update_test_item(self, item_uuid, attributes=None, description=None):
452452
453453 def current_item (self ):
454454 """Retrieve the last item reported by the client."""
455- # noinspection PyUnresolvedReferences
456455 return self ._item_stack [- 1 ] if len (self ._item_stack ) > 0 else None
456+
457+ def clone (self ):
458+ """Clone the client object, set current Item ID as cloned item ID.
459+
460+ :returns: Cloned client object
461+ :rtype: RPClient
462+ """
463+ cloned = RPClient (
464+ endpoint = self .endpoint ,
465+ project = self .project ,
466+ token = self .token ,
467+ log_batch_size = self .log_batch_size ,
468+ is_skipped_an_issue = self .is_skipped_an_issue ,
469+ verify_ssl = self .verify_ssl ,
470+ retries = self .retries ,
471+ max_pool_size = self .max_pool_size ,
472+ launch_id = self .launch_id ,
473+ http_timeout = self .http_timeout ,
474+ log_batch_payload_size = self .log_batch_payload_size ,
475+ mode = self .mode
476+ )
477+ current_item = self .current_item ()
478+ if current_item :
479+ cloned ._item_stack .append (current_item )
480+ return cloned
0 commit comments