99
1010from reportportal_client import ReportPortalServiceAsync
1111
12+ log = logging .getLogger (__name__ )
13+
1214
1315def timestamp ():
1416 return str (int (time () * 1000 ))
@@ -39,8 +41,8 @@ def init_service(self, endpoint, project, uuid, log_batch_size,
3941 if self .RP is None :
4042 self .ignore_errors = ignore_errors
4143 self .ignored_tags = ignored_tags
42- logging .debug ('ReportPortal - Init service: endpoint=%s, '
43- 'project=%s, uuid=%s' , endpoint , project , uuid )
44+ log .debug ('ReportPortal - Init service: endpoint=%s, '
45+ 'project=%s, uuid=%s' , endpoint , project , uuid )
4446 self .RP = ReportPortalServiceAsync (
4547 endpoint = endpoint ,
4648 project = project ,
@@ -49,7 +51,7 @@ def init_service(self, endpoint, project, uuid, log_batch_size,
4951 log_batch_size = log_batch_size
5052 )
5153 else :
52- logging .debug ('The pytest is already initialized' )
54+ log .debug ('The pytest is already initialized' )
5355 return self .RP
5456
5557 def async_error_handler (self , exc_info ):
@@ -84,11 +86,9 @@ def start_launch(
8486 'mode' : mode ,
8587 'tags' : tags
8688 }
87- logging .debug ('ReportPortal - Start launch: '
88- 'request_body=%s' , sl_pt )
89+ log .debug ('ReportPortal - Start launch: equest_body=%s' , sl_pt )
8990 req_data = self .RP .start_launch (** sl_pt )
90- logging .debug ('ReportPortal - Launch started: '
91- 'response_body=%s' , req_data )
91+ log .debug ('ReportPortal - Launch started: response_body=%s' , req_data )
9292
9393 def start_pytest_item (self , test_item = None ):
9494 self ._stop_if_necessary ()
@@ -103,8 +103,7 @@ def start_pytest_item(self, test_item=None):
103103 'item_type' : 'STEP'
104104 }
105105
106- logging .debug ('ReportPortal - Start TestItem: '
107- 'request_body=%s' , start_rq )
106+ log .debug ('ReportPortal - Start TestItem: request_body=%s' , start_rq )
108107 self .RP .start_test_item (** start_rq )
109108
110109 def _get_tags (self , item ):
@@ -124,8 +123,7 @@ def finish_pytest_item(self, status, issue=None):
124123 'issue' : issue
125124 }
126125
127- logging .debug ('ReportPortal - Finish TestItem: '
128- 'request_body=%s' , fta_rq )
126+ log .debug ('ReportPortal - Finish TestItem: request_body=%s' , fta_rq )
129127 self .RP .finish_test_item (** fta_rq )
130128
131129 def finish_launch (self , launch = None , status = 'rp_launch' ):
@@ -138,7 +136,7 @@ def finish_launch(self, launch=None, status='rp_launch'):
138136 'end_time' : timestamp (),
139137 'status' : status
140138 }
141- logging .debug ('ReportPortal - Finish launch: request_body=%s' , fl_rq )
139+ log .debug ('ReportPortal - Finish launch: request_body=%s' , fl_rq )
142140 self .RP .finish_launch (** fl_rq )
143141
144142 def post_log (self , message , loglevel = 'INFO' , attachment = None ):
@@ -147,8 +145,8 @@ def post_log(self, message, loglevel='INFO', attachment=None):
147145 return
148146
149147 if loglevel not in self ._loglevels :
150- logging .warning ('Incorrect loglevel = %s. Force set to INFO. '
151- 'Available levels: %s.' , loglevel , self ._loglevels )
148+ log .warning ('Incorrect loglevel = %s. Force set to INFO. '
149+ 'Available levels: %s.' , loglevel , self ._loglevels )
152150 loglevel = 'INFO'
153151
154152 sl_rq = {
0 commit comments