From 60dc18858a2ba6302d52760c45894042bf790c6c Mon Sep 17 00:00:00 2001 From: "reportportal.io" Date: Mon, 21 Oct 2024 11:08:29 +0000 Subject: [PATCH 1/4] Changelog update --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d38337..d8036e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [Unreleased] + +## [5.4.3] ### Fixed - Issue [#375](https://github.com/reportportal/agent-python-pytest/issues/375): Fix max Item name length, by @HardNorth ### Added From 702cc9b738b1c269fe722b48870b61a828fe79f3 Mon Sep 17 00:00:00 2001 From: "reportportal.io" Date: Mon, 21 Oct 2024 11:08:30 +0000 Subject: [PATCH 2/4] Version update --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6e81a2d..dcfd8e8 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ from setuptools import setup -__version__ = '5.4.3' +__version__ = '5.4.4' def read_file(fname): From ebf4a4edc58e667d89f6e0039c613e22cf4a20fd Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Tue, 22 Oct 2024 10:09:06 +0300 Subject: [PATCH 3/4] Max Item name fix --- CHANGELOG.md | 4 ++-- pytest_reportportal/service.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8036e3..71caabd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,10 @@ # Changelog ## [Unreleased] - -## [5.4.3] ### Fixed - Issue [#375](https://github.com/reportportal/agent-python-pytest/issues/375): Fix max Item name length, by @HardNorth + +## [5.4.3] ### Added - Issue [#332](https://github.com/reportportal/agent-python-pytest/issues/332): Support for fixture reporting, by @HardNorth diff --git a/pytest_reportportal/service.py b/pytest_reportportal/service.py index 12905c5..d786875 100644 --- a/pytest_reportportal/service.py +++ b/pytest_reportportal/service.py @@ -52,7 +52,7 @@ log = logging.getLogger(__name__) -MAX_ITEM_NAME_LENGTH: int = 256 +MAX_ITEM_NAME_LENGTH: int = 1024 TRUNCATION_STR: str = '...' ROOT_DIR: str = str(os.path.abspath(curdir)) PYTEST_MARKS_IGNORE: Set[str] = {'parametrize', 'usefixtures', 'filterwarnings'} From c5678f5f70029ac5865cc5da3038936dfd6c1c7b Mon Sep 17 00:00:00 2001 From: Vadzim Hushchanskou Date: Tue, 22 Oct 2024 10:37:46 +0300 Subject: [PATCH 4/4] Add max item name tests --- examples/test_max_item_name.py | 17 ++++++++++++ tests/integration/test_max_name_length.py | 33 +++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 examples/test_max_item_name.py create mode 100644 tests/integration/test_max_name_length.py diff --git a/examples/test_max_item_name.py b/examples/test_max_item_name.py new file mode 100644 index 0000000..e96d684 --- /dev/null +++ b/examples/test_max_item_name.py @@ -0,0 +1,17 @@ +# Copyright 2024 EPAM Systems +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +def test_thi_is_simple_example_test_with_the_name_longer_than_maximum_allowed_lorem_ipsum_dolor_sit_amet_consectetur_adipiscing_elit_sed_do_eiusmod_tempor_incididunt_ut_labore_et_dolore_magna_aliqua_ut_enim_ad_minim_veniam_quis_nostrud_exercitation_ullamco_laboris_nisi_ut_aliquip_ex_ea_commodo_consequat_duis_aute_irure_dolor_in_reprehenderit_in_voluptate_velit_esse_cillum_dolore_eu_fugiat_nulla_pariatur_excepteur_sint_occaecat_cupidatat_non_proident_sunt_in_culpa_qui_officia_deserunt_mollit_anim_id_est_laborum_sed_ut_perspiciatis_unde_omnis_iste_natus_error_sit_voluptatem_accusantium_doloremque_laudantium_totam_rem_aperiam_eaque_ipsa_quae_ab_illo_inventore_veritatis_et_quasi_architecto_beatae_vitae_dicta_sunt_explicabo_nemo_enim_ipsam_voluptatem_quia_voluptas_sit_aspernatur_aut_odit_aut_fugit_sed_quia_consequuntur_magni_dolores_eos_qui_ratione_voluptatem_sequi_nesciunt_neque_porro_quisquam_est_qui_dolorem_ipsum_quia_dolor_sit_amet_consectetur_adipisci_velit_sed_quia_non_numquam_eius_modi_tempora_incidunt_ut_labore_et_dolore_magnam_aliquam_quaerat_voluptatem(): # noqa: E501 + """Simple example test with the name longer than maximum allowed.""" + assert True diff --git a/tests/integration/test_max_name_length.py b/tests/integration/test_max_name_length.py new file mode 100644 index 0000000..11a1b9f --- /dev/null +++ b/tests/integration/test_max_name_length.py @@ -0,0 +1,33 @@ +# Copyright 2024 EPAM Systems +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from unittest import mock + +from tests import REPORT_PORTAL_SERVICE +from tests.helpers import utils + + +@mock.patch(REPORT_PORTAL_SERVICE) +def test_custom_attribute_report(mock_client_init): + result = utils.run_pytest_tests(tests=['examples/test_max_item_name.py'], variables=utils.DEFAULT_VARIABLES) + assert int(result) == 0, 'Exit code should be 0 (no errors)' + + mock_client = mock_client_init.return_value + start_count = mock_client.start_test_item.call_count + finish_count = mock_client.finish_test_item.call_count + assert start_count == finish_count == 1, 'Incorrect number of "start_test_item" or "finish_test_item" calls' + + call_args = mock_client.start_test_item.call_args_list + step_call_args = call_args[0][1] + assert len(step_call_args['name']) == 1024, 'Incorrect item name length'