@@ -88,6 +88,7 @@ class Client:
88
88
mode : str
89
89
launch_uuid_print : bool
90
90
print_output : OutputType
91
+ truncate_attributes : bool
91
92
_skip_analytics : str
92
93
_session : Optional [RetryingClientSession ]
93
94
__stat_task : Optional [asyncio .Task ]
@@ -107,6 +108,7 @@ def __init__(
107
108
mode : str = 'DEFAULT' ,
108
109
launch_uuid_print : bool = False ,
109
110
print_output : OutputType = OutputType .STDOUT ,
111
+ truncate_attributes : bool = True ,
110
112
** kwargs : Any
111
113
) -> None :
112
114
"""Initialize the class instance with arguments.
@@ -125,6 +127,7 @@ def __init__(
125
127
:param mode: Launch mode, all Launches started by the client will be in that mode.
126
128
:param launch_uuid_print: Print Launch UUID into passed TextIO or by default to stdout.
127
129
:param print_output: Set output stream for Launch UUID printing.
130
+ :param truncate_attributes: Truncate test item attributes to default maximum length.
128
131
"""
129
132
self .api_v1 , self .api_v2 = 'v1' , 'v2'
130
133
self .endpoint = endpoint
@@ -144,6 +147,7 @@ def __init__(
144
147
self ._session = None
145
148
self .__stat_task = None
146
149
self .api_key = api_key
150
+ self .truncate_attributes = truncate_attributes
147
151
148
152
async def session (self ) -> RetryingClientSession :
149
153
"""Return aiohttp.ClientSession class instance, initialize it if necessary.
@@ -156,7 +160,7 @@ async def session(self) -> RetryingClientSession:
156
160
if self .verify_ssl is None or (type (self .verify_ssl ) == bool and not self .verify_ssl ):
157
161
ssl_config = False
158
162
else :
159
- if type (self .verify_ssl ) == str :
163
+ if type (self .verify_ssl ) is str :
160
164
ssl_config = ssl .create_default_context (ssl .Purpose .CLIENT_AUTH , cafile = self .verify_ssl )
161
165
else :
162
166
ssl_config = ssl .create_default_context (ssl .Purpose .CLIENT_AUTH , cafile = certifi .where ())
@@ -242,7 +246,7 @@ async def start_launch(self,
242
246
request_payload = LaunchStartRequest (
243
247
name = name ,
244
248
start_time = start_time ,
245
- attributes = attributes ,
249
+ attributes = verify_value_length ( attributes ) if self . truncate_attributes else attributes ,
246
250
description = description ,
247
251
mode = self .mode ,
248
252
rerun = rerun ,
@@ -306,7 +310,7 @@ async def start_test_item(self,
306
310
start_time ,
307
311
item_type ,
308
312
launch_uuid ,
309
- attributes = verify_value_length (attributes ),
313
+ attributes = verify_value_length (attributes ) if self . truncate_attributes else attributes ,
310
314
code_ref = code_ref ,
311
315
description = description ,
312
316
has_stats = has_stats ,
@@ -355,7 +359,7 @@ async def finish_test_item(self,
355
359
end_time ,
356
360
launch_uuid ,
357
361
status ,
358
- attributes = verify_value_length (attributes ),
362
+ attributes = verify_value_length (attributes ) if self . truncate_attributes else attributes ,
359
363
description = description ,
360
364
is_skipped_an_issue = self .is_skipped_an_issue ,
361
365
issue = issue ,
@@ -389,7 +393,7 @@ async def finish_launch(self,
389
393
request_payload = LaunchFinishRequest (
390
394
end_time ,
391
395
status = status ,
392
- attributes = verify_value_length (attributes ),
396
+ attributes = verify_value_length (attributes ) if self . truncate_attributes else attributes ,
393
397
description = kwargs .get ('description' )
394
398
).payload
395
399
response = await AsyncHttpRequest ((await self .session ()).put , url = url , json = request_payload ,
@@ -415,7 +419,7 @@ async def update_test_item(self,
415
419
"""
416
420
data = {
417
421
'description' : description ,
418
- 'attributes' : verify_value_length (attributes ),
422
+ 'attributes' : verify_value_length (attributes ) if self . truncate_attributes else attributes ,
419
423
}
420
424
item_id = await self .get_item_id_by_uuid (item_uuid )
421
425
url = root_uri_join (self .base_url_v1 , 'item' , item_id , 'update' )
@@ -650,6 +654,7 @@ def __init__(
650
654
:param mode: Launch mode, all Launches started by the client will be in that mode.
651
655
:param launch_uuid_print: Print Launch UUID into passed TextIO or by default to stdout.
652
656
:param print_output: Set output stream for Launch UUID printing.
657
+ :param truncate_attributes: Truncate test item attributes to default maximum length.
653
658
:param client: ReportPortal async Client instance to use. If set, all above arguments
654
659
will be ignored.
655
660
:param launch_uuid: A launch UUID to use instead of starting own one.
@@ -1009,6 +1014,7 @@ def __init__(
1009
1014
:param mode: Launch mode, all Launches started by the client will be in that mode.
1010
1015
:param launch_uuid_print: Print Launch UUID into passed TextIO or by default to stdout.
1011
1016
:param print_output: Set output stream for Launch UUID printing.
1017
+ :param truncate_attributes: Truncate test item attributes to default maximum length.
1012
1018
:param client: ReportPortal async Client instance to use. If set, all above arguments
1013
1019
will be ignored.
1014
1020
:param launch_uuid: A launch UUID to use instead of starting own one.
@@ -1384,6 +1390,7 @@ def __init__(
1384
1390
:param mode: Launch mode, all Launches started by the client will be in that mode.
1385
1391
:param launch_uuid_print: Print Launch UUID into passed TextIO or by default to stdout.
1386
1392
:param print_output: Set output stream for Launch UUID printing.
1393
+ :param truncate_attributes: Truncate test item attributes to default maximum length.
1387
1394
:param client: ReportPortal async Client instance to use. If set, all above arguments
1388
1395
will be ignored.
1389
1396
:param launch_uuid: A launch UUID to use instead of starting own one.
@@ -1406,7 +1413,7 @@ def __init__(
1406
1413
self .shutdown_timeout = shutdown_timeout
1407
1414
self .__init_task_list (task_list , task_mutex )
1408
1415
self .__init_loop (loop )
1409
- if type (launch_uuid ) == str :
1416
+ if type (launch_uuid ) is str :
1410
1417
super ().__init__ (endpoint , project ,
1411
1418
launch_uuid = self .create_task (self .__return_value (launch_uuid )), ** kwargs )
1412
1419
else :
@@ -1561,6 +1568,7 @@ def __init__(
1561
1568
:param mode: Launch mode, all Launches started by the client will be in that mode.
1562
1569
:param launch_uuid_print: Print Launch UUID into passed TextIO or by default to stdout.
1563
1570
:param print_output: Set output stream for Launch UUID printing.
1571
+ :param truncate_attributes: Truncate test item attributes to default maximum length.
1564
1572
:param client: ReportPortal async Client instance to use. If set, all above arguments
1565
1573
will be ignored.
1566
1574
:param launch_uuid: A launch UUID to use instead of starting own one.
@@ -1588,7 +1596,7 @@ def __init__(
1588
1596
self .__init_task_list (task_list , task_mutex )
1589
1597
self .__last_run_time = datetime .time ()
1590
1598
self .__init_loop (loop )
1591
- if type (launch_uuid ) == str :
1599
+ if type (launch_uuid ) is str :
1592
1600
super ().__init__ (endpoint , project ,
1593
1601
launch_uuid = self .create_task (self .__return_value (launch_uuid )), ** kwargs )
1594
1602
else :
0 commit comments