diff --git a/capella2polarion/converters/link_converter.py b/capella2polarion/converters/link_converter.py index a46abaa7..eef4b639 100644 --- a/capella2polarion/converters/link_converter.py +++ b/capella2polarion/converters/link_converter.py @@ -72,7 +72,11 @@ def create_links_for_work_item( if isinstance(refs, common.ElementList): new = refs.by_uuid # type: ignore[assignment] elif refs is None: - logger.info("For model element %r attribute %s is not set", obj._short_repr_(), link_config.capella_attr) + logger.info( + 'For model element %r attribute "%s" is not set', + obj._short_repr_(), + link_config.capella_attr, + ) continue else: assert hasattr(refs, "uuid"), "No 'uuid' on value" diff --git a/tests/test_elements.py b/tests/test_elements.py index 0fefa265..a2f46c3b 100644 --- a/tests/test_elements.py +++ b/tests/test_elements.py @@ -491,13 +491,11 @@ def test_create_links_logs_warning_model_element_behind_attribute_is_none( base_object: BaseObjectContainer, caplog: pytest.LogCaptureFixture ): expected = ( - "Link creation for \"\" failed:" - "\n\tRequested attribute: 'attribute'" - "\n\tNo model element behind that attribute" - "\n\t--------" + "For model element \"\" " + 'attribute "attribute" is not set' ) - with caplog.at_level(logging.WARNING): + with caplog.at_level(logging.INFO): link_serializer = link_converter.LinkSerializer( base_object.pw.polarion_data_repo, base_object.mc.converter_session, @@ -507,7 +505,9 @@ def test_create_links_logs_warning_model_element_behind_attribute_is_none( links = link_serializer.create_links_for_work_item("uuid1") assert not links - assert caplog.messages[0] == expected + assert len(caplog.records) == 1 + assert caplog.records[0].levelno == 20 + assert caplog.records[0].message == expected @staticmethod def test_create_links_no_new_links_with_errors(