From 7e547c0008a05811f32a0cdf564400de3a07d9dc Mon Sep 17 00:00:00 2001 From: ewuerger Date: Thu, 26 Sep 2024 15:29:42 +0200 Subject: [PATCH] ci: Please pylint --- tests/conftest.py | 16 +++++++--------- tests/test_elements.py | 15 +++++---------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 41f5b7f..c6b296c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -37,6 +37,12 @@ DOCUMENT_TEMPLATES = TEST_DOCUMENT_ROOT / "templates" DOCUMENT_TEXT_WORK_ITEMS = "document_work_items.html.j2" DOCUMENT_WORK_ITEMS_CROSS_PROJECT = "work_items_cross_project.html.j2" +LINK_CONFIG = converter_config.LinkConfig( + capella_attr="attribute", + polarion_role="attribute", + link_field="attribute", + reverse_field="attribute_reverse", +) @pytest.fixture @@ -135,15 +141,7 @@ def base_object( fake = FakeModelObject("uuid1", name="Fake 1") fake_model_type_config = converter_config.CapellaTypeConfig( - "fakeModelObject", - links=[ - converter_config.LinkConfig( - capella_attr="attribute", - polarion_role="attribute", - link_field="attribute", - reverse_field="attribute_reverse", - ) - ], + "fakeModelObject", links=[LINK_CONFIG] ) mc = model_converter.ModelConverter( diff --git a/tests/test_elements.py b/tests/test_elements.py index 9c44cb5..0757634 100644 --- a/tests/test_elements.py +++ b/tests/test_elements.py @@ -27,6 +27,7 @@ # pylint: disable-next=relative-beyond-top-level, useless-suppression from .conftest import ( # type: ignore[import] + LINK_CONFIG, TEST_MODEL_ELEMENTS_CONFIG, BaseObjectContainer, FakeModelObject, @@ -176,15 +177,7 @@ def grouped_links_base_object( dummy_work_items: dict[str, data_models.CapellaWorkItem], ) -> GroupedLinksBaseObject: config = converter_config.CapellaTypeConfig( - "fakeModelObject", - links=[ - converter_config.LinkConfig( - capella_attr="attribute", - polarion_role="attribute", - link_field="attribute", - reverse_field="attribute_reverse", - ) - ], + "fakeModelObject", links=[LINK_CONFIG] ) mock_model = mock.MagicMock() fake_2 = FakeModelObject("uuid2", "Fake 2") @@ -993,6 +986,8 @@ def test_update_links(base_object: BaseObjectContainer): type="fakeModelObject", ) ) + for data in base_object.mc.converter_session.values(): + data.type_config.links[0].polarion_role = "attribute" base_object.pw.project_client.work_items.links.get_all.side_effect = ( [link], @@ -1266,7 +1261,7 @@ def test_maintain_grouped_links_attributes_with_role_prefix( @staticmethod def test_grouped_links_attributes_different_link_field_in_config( - base_object: BaseObjectContainer, monkeypatch: pytest.MonkeyPatch + base_object: BaseObjectContainer, ): converter_data_1 = base_object.mc.converter_session["uuid1"] converter_data_2 = base_object.mc.converter_session["uuid2"]