Skip to content

Commit 7bb0156

Browse files
committed
Fix build
1 parent 2d0e272 commit 7bb0156

14 files changed

Lines changed: 227 additions & 82 deletions

File tree

reportportal_client/_internal/static/defines.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
10000: "DEBUG",
2727
5000: "TRACE",
2828
}
29+
DEFAULT_LOG_LEVEL = RP_LOG_LEVELS[40000]
2930

3031

3132
class _PresenceSentinel:

reportportal_client/aio/client.py

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454

5555
# noinspection PyProtectedMember
5656
from reportportal_client._internal.static.abstract import AbstractBaseClass, abstractmethod
57+
from reportportal_client._internal.static.defines import DEFAULT_LOG_LEVEL
5758

5859
# noinspection PyProtectedMember
5960
from reportportal_client.aio.tasks import Task
@@ -375,8 +376,6 @@ async def start_launch(
375376
truncate_attributes_enabled=self.truncate_attributes,
376377
truncate_fields_enabled=self.truncate_fields,
377378
replace_binary_characters=self.replace_binary_chars,
378-
launch_name_length_limit=self.launch_name_length_limit,
379-
launch_description_length_limit=self.launch_description_length_limit,
380379
description=description,
381380
mode=self.mode,
382381
rerun=rerun,
@@ -445,16 +444,14 @@ async def start_test_item(
445444
else:
446445
url = root_uri_join(self.base_url_v2, "item")
447446
request_payload = AsyncItemStartRequest(
448-
name,
449-
start_time,
450-
item_type,
451-
launch_uuid,
447+
name=name,
448+
start_time=start_time,
449+
type_=item_type,
450+
launch_uuid=launch_uuid,
452451
attributes=attributes,
453452
truncate_attributes_enabled=self.truncate_attributes,
454453
truncate_fields_enabled=self.truncate_fields,
455454
replace_binary_characters=self.replace_binary_chars,
456-
item_name_length_limit=self.item_name_length_limit,
457-
item_description_length_limit=self.item_description_length_limit,
458455
code_ref=code_ref,
459456
description=description,
460457
has_stats=has_stats,
@@ -511,14 +508,13 @@ async def finish_test_item(
511508
"""
512509
url = self.__get_item_url(item_id)
513510
request_payload = AsyncItemFinishRequest(
514-
end_time,
515-
launch_uuid,
516-
status,
511+
end_time=end_time,
512+
launch_uuid=launch_uuid,
513+
status=status,
517514
attributes=attributes,
518515
truncate_attributes_enabled=self.truncate_attributes,
519516
truncate_fields_enabled=self.truncate_fields,
520517
replace_binary_characters=self.replace_binary_chars,
521-
item_description_length_limit=self.item_description_length_limit,
522518
description=description,
523519
test_case_id=test_case_id,
524520
is_skipped_an_issue=self.is_skipped_an_issue,
@@ -556,13 +552,12 @@ async def finish_launch(
556552
"""
557553
url = self.__get_launch_url(launch_uuid)
558554
request_payload = LaunchFinishRequest(
559-
end_time,
555+
end_time=end_time,
560556
status=status,
561557
attributes=attributes,
562558
truncate_attributes_enabled=self.truncate_attributes,
563559
truncate_fields_enabled=self.truncate_fields,
564560
replace_binary_characters=self.replace_binary_chars,
565-
launch_description_length_limit=self.launch_description_length_limit,
566561
description=kwargs.get("description"),
567562
).payload
568563
response = await AsyncHttpRequest(
@@ -593,7 +588,6 @@ async def update_test_item(
593588
truncate_attributes_enabled=self.truncate_attributes,
594589
truncate_fields_enabled=self.truncate_fields,
595590
replace_binary_characters=self.replace_binary_chars,
596-
item_description_length_limit=self.item_description_length_limit,
597591
).payload
598592
item_id = await self.get_item_id_by_uuid(item_uuid)
599593
url = root_uri_join(self.base_url_v1, "item", item_id, "update")
@@ -699,7 +693,15 @@ async def log_batch(self, log_batch: Optional[list[AsyncRPRequestLog]]) -> Optio
699693

700694
url = root_uri_join(self.base_url_v2, "log")
701695
response = await ErrorPrintingAsyncHttpRequest(
702-
(await self.session()).post, url=url, data=AsyncRPLogBatch(log_batch).payload, name="log"
696+
(await self.session()).post,
697+
url=url,
698+
data=AsyncRPLogBatch(
699+
truncate_attributes_enabled=None,
700+
truncate_fields_enabled=None,
701+
replace_binary_characters=None,
702+
log_reqs=log_batch,
703+
).payload,
704+
name="log",
703705
).make()
704706
return await response.messages if response else None
705707

@@ -1126,8 +1128,19 @@ async def log(
11261128
:param item_id: UUID of the ReportPortal Item the message belongs to.
11271129
:return: Response message Tuple if Log message batch was sent or None.
11281130
"""
1131+
rp_level = str(level) if level else DEFAULT_LOG_LEVEL
11291132
rp_file = RPFile(**attachment) if attachment else None
1130-
rp_log = AsyncRPRequestLog(self.__launch_uuid, time, rp_file, item_id, level, message)
1133+
rp_log = AsyncRPRequestLog(
1134+
truncate_attributes_enabled=None,
1135+
truncate_fields_enabled=None,
1136+
replace_binary_characters=None,
1137+
launch_uuid=self.__launch_uuid,
1138+
time=time,
1139+
file=rp_file,
1140+
item_uuid=item_id,
1141+
level=rp_level,
1142+
message=message,
1143+
)
11311144
return await self.__client.log_batch(await self._log_batcher.append_async(rp_log))
11321145

11331146
def clone(self) -> "AsyncRPClient":
@@ -1577,8 +1590,19 @@ def log(
15771590
:param item_id: UUID of the ReportPortal Item the message belongs to.
15781591
:return: Response message Tuple if Log message batch was sent or None.
15791592
"""
1593+
rp_level = str(level) if level else DEFAULT_LOG_LEVEL
15801594
rp_file = RPFile(**attachment) if attachment else None
1581-
rp_log = AsyncRPRequestLog(self.launch_uuid, time, rp_file, item_id, level, message)
1595+
rp_log = AsyncRPRequestLog(
1596+
truncate_attributes_enabled=None,
1597+
truncate_fields_enabled=None,
1598+
replace_binary_characters=None,
1599+
launch_uuid=self.launch_uuid,
1600+
time=time,
1601+
file=rp_file,
1602+
item_uuid=item_id,
1603+
level=rp_level,
1604+
message=message,
1605+
)
15821606
return self.create_task(self._log(rp_log))
15831607

15841608
def close(self) -> None:

reportportal_client/client.py

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,6 @@ def start_launch(
665665
truncate_attributes_enabled=self.truncate_attributes,
666666
truncate_fields_enabled=self.truncate_fields,
667667
replace_binary_characters=self.replace_binary_chars,
668-
launch_name_length_limit=self.launch_name_length_limit,
669-
launch_description_length_limit=self.launch_description_length_limit,
670668
description=description,
671669
mode=self.mode,
672670
rerun=rerun,
@@ -735,16 +733,14 @@ def start_test_item(
735733
else:
736734
url = uri_join(self.base_url_v2, "item")
737735
request_payload = ItemStartRequest(
738-
name,
739-
start_time,
740-
item_type,
741-
self.__launch_uuid,
736+
name=name,
737+
start_time=start_time,
738+
type_=item_type,
739+
launch_uuid=self.__launch_uuid,
742740
attributes=attributes,
743741
truncate_attributes_enabled=self.truncate_attributes,
744742
truncate_fields_enabled=self.truncate_fields,
745743
replace_binary_characters=self.replace_binary_chars,
746-
item_name_length_limit=self.item_name_length_limit,
747-
item_description_length_limit=self.item_description_length_limit,
748744
code_ref=code_ref,
749745
description=description,
750746
has_stats=has_stats,
@@ -807,14 +803,13 @@ def finish_test_item(
807803
return None
808804
url = uri_join(self.base_url_v2, "item", item_id)
809805
request_payload = ItemFinishRequest(
810-
end_time,
811-
self.__launch_uuid,
812-
status,
806+
end_time=end_time,
807+
launch_uuid=self.__launch_uuid,
808+
status=status,
813809
attributes=attributes,
814810
truncate_attributes_enabled=self.truncate_attributes,
815811
truncate_fields_enabled=self.truncate_fields,
816812
replace_binary_characters=self.replace_binary_chars,
817-
item_description_length_limit=self.item_description_length_limit,
818813
description=description,
819814
is_skipped_an_issue=self.is_skipped_an_issue,
820815
issue=issue,
@@ -857,13 +852,12 @@ def finish_launch(
857852
return None
858853
url = uri_join(self.base_url_v2, "launch", self.__launch_uuid, "finish")
859854
request_payload = LaunchFinishRequest(
860-
end_time,
855+
end_time=end_time,
861856
status=status,
862857
attributes=attributes,
863858
truncate_attributes_enabled=self.truncate_attributes,
864859
truncate_fields_enabled=self.truncate_fields,
865860
replace_binary_characters=self.replace_binary_chars,
866-
launch_description_length_limit=self.launch_description_length_limit,
867861
description=kwargs.get("description"),
868862
).payload
869863
response = HttpRequest(
@@ -902,7 +896,6 @@ def update_test_item(
902896
truncate_attributes_enabled=self.truncate_attributes,
903897
truncate_fields_enabled=self.truncate_fields,
904898
replace_binary_characters=self.replace_binary_chars,
905-
item_description_length_limit=self.item_description_length_limit,
906899
).payload
907900
item_id = self.get_item_id_by_uuid(item_uuid)
908901
if not item_id:
@@ -929,7 +922,12 @@ def _log(self, batch: Optional[list[RPRequestLog]]) -> Optional[tuple[str, ...]]
929922
response = ErrorPrintingHttpRequest(
930923
self.session.post,
931924
url,
932-
files=RPLogBatch(batch).payload,
925+
files=RPLogBatch(
926+
truncate_attributes_enabled=None,
927+
truncate_fields_enabled=None,
928+
replace_binary_characters=None,
929+
log_reqs=batch,
930+
).payload,
933931
verify_ssl=self.verify_ssl,
934932
http_timeout=self.http_timeout,
935933
name="log",
@@ -957,7 +955,17 @@ def log(
957955
:return: Response message Tuple if Log message batch was sent or None.
958956
"""
959957
rp_file = RPFile(**attachment) if attachment else None
960-
rp_log = RPRequestLog(self.__launch_uuid, time, rp_file, item_id, str(level), message)
958+
rp_log = RPRequestLog(
959+
truncate_attributes_enabled=None,
960+
truncate_fields_enabled=None,
961+
replace_binary_characters=None,
962+
launch_uuid=self.__launch_uuid,
963+
time=time,
964+
file=rp_file,
965+
item_uuid=item_id,
966+
level=str(level),
967+
message=message,
968+
)
961969
return self._log(self._log_batcher.append(rp_log))
962970

963971
def get_item_id_by_uuid(self, item_uuid: str) -> Optional[str]:

0 commit comments

Comments
 (0)