From 42f198cfcd4613edc6a3de1ee82515a0dfeb95a2 Mon Sep 17 00:00:00 2001 From: ewuerger Date: Tue, 25 Jun 2024 12:15:31 +0200 Subject: [PATCH 1/2] fix: Only use prefix options when variable is set --- ci-templates/gitlab/synchronise_elements.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-templates/gitlab/synchronise_elements.yml b/ci-templates/gitlab/synchronise_elements.yml index fd63e775..6e020b11 100644 --- a/ci-templates/gitlab/synchronise_elements.yml +++ b/ci-templates/gitlab/synchronise_elements.yml @@ -19,6 +19,6 @@ capella2polarion_synchronise_elements: --polarion-project-id=${CAPELLA2POLARION_PROJECT_ID:?} \ --capella-model="${CAPELLA2POLARION_MODEL_JSON:?}" \ --synchronize-config=${CAPELLA2POLARION_CONFIG:?} \ - --type-prefix="${CAPELLA2POLARION_TYPE_PREFIX:?}" \ - --role-prefix="${CAPELLA2POLARION_ROLE_PREFIX:?}" \ + ${CAPELLA2POLARION_TYPE_PREFIX:+--type-prefix="$CAPELLA2POLARION_TYPE_PREFIX"} \ + ${CAPELLA2POLARION_ROLE_PREFIX:+--role-prefix="$CAPELLA2POLARION_ROLE_PREFIX"} \ synchronize From a34541e1f1b2d12bd134312b9eb17b612efa5cd9 Mon Sep 17 00:00:00 2001 From: Martin Lehmann Date: Tue, 25 Jun 2024 15:17:01 +0200 Subject: [PATCH 2/2] test: Only compare stable prefix in assertion --- tests/test_elements.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/test_elements.py b/tests/test_elements.py index b44ddac5..b20ea4a0 100644 --- a/tests/test_elements.py +++ b/tests/test_elements.py @@ -476,8 +476,7 @@ def test_create_links_no_new_links_with_errors( expected = ( "Link creation for \"\" failed:" "\n\tRequested attribute: non_existent_attr" - "\n\tAssertionError assert False" - "\n\t--------" + "\n\t" ) work_item_obj_2 = data_models.CapellaWorkItem( @@ -517,7 +516,7 @@ def error(): assert not links assert len(caplog.messages) == 1 - assert caplog.messages[0] == expected + assert caplog.messages[0].startswith(expected) assert len(base_object.mc.converter_session["uuid2"].errors) == 3 @staticmethod @@ -528,8 +527,7 @@ def test_create_links_with_new_links_and_errors( "Link creation for \"\" " "partially successful. Some links were not created:" "\n\tRequested attribute: non_existent_attr" - "\n\tAssertionError assert False" - "\n\t--------" + "\n\t" ) work_item_obj_2 = data_models.CapellaWorkItem( @@ -594,7 +592,7 @@ def error(): assert links == [expected_link] assert len(caplog.messages) == 1 - assert caplog.messages[0] == expected + assert caplog.messages[0].startswith(expected) @staticmethod def test_create_links_from_ElementList(base_object: BaseObjectContainer):