From 4945b646a4e9982981ed1fa09e0bac396009c40b Mon Sep 17 00:00:00 2001 From: Tiexin Guo Date: Tue, 30 Jul 2024 11:50:54 +0800 Subject: [PATCH 1/5] feat: add owner --- interface_tester/collector.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/interface_tester/collector.py b/interface_tester/collector.py index 5ef08b3..87bf4bd 100644 --- a/interface_tester/collector.py +++ b/interface_tester/collector.py @@ -66,6 +66,7 @@ class _InterfacesDotYamlSpec(TypedDict): providers: List[_CharmTestConfig] requirers: List[_CharmTestConfig] + owner: str class _RoleTestSpec(TypedDict): @@ -173,6 +174,7 @@ def _gather_charms_for_version(version_dir: Path) -> Optional[_InterfacesDotYaml providers = charms.get("providers", []) requirers = charms.get("requirers", []) + owner = charms.get("owner", "") if not isinstance(providers, list) or not isinstance(requirers, list): raise TypeError( @@ -196,7 +198,11 @@ def _gather_charms_for_version(version_dir: Path) -> Optional[_InterfacesDotYaml continue destination.append(cfg) - spec: _InterfacesDotYamlSpec = {"providers": provider_configs, "requirers": requirer_configs} + spec: _InterfacesDotYamlSpec = { + "providers": provider_configs, + "requirers": requirer_configs, + "owner": owner, + } return spec @@ -270,6 +276,7 @@ def gather_test_spec_for_version( "schema": schemas.get("requirer"), "charms": charms.get("requirers", []) if charms else [], }, + "owner": charms.get("owner", "") if charms else "", } From 45a2434e28fba96b5a779ddd73871340eee536c2 Mon Sep 17 00:00:00 2001 From: Tiexin Guo Date: Tue, 30 Jul 2024 12:50:30 +0800 Subject: [PATCH 2/5] add owner --- interface_tester/collector.py | 1 + 1 file changed, 1 insertion(+) diff --git a/interface_tester/collector.py b/interface_tester/collector.py index 87bf4bd..1b1f09c 100644 --- a/interface_tester/collector.py +++ b/interface_tester/collector.py @@ -82,6 +82,7 @@ class InterfaceTestSpec(TypedDict): provider: _RoleTestSpec requirer: _RoleTestSpec + owner: str def get_schema_from_module(module: object, name: str) -> Type[pydantic.BaseModel]: From ba6a3ec36b5d8fc34e43c4c57cb0e6e957ae11b2 Mon Sep 17 00:00:00 2001 From: Tiexin Guo Date: Wed, 7 Aug 2024 15:51:17 +0800 Subject: [PATCH 3/5] chore: update owner to owners as a list --- interface_tester/collector.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/interface_tester/collector.py b/interface_tester/collector.py index 1b1f09c..b405525 100644 --- a/interface_tester/collector.py +++ b/interface_tester/collector.py @@ -66,7 +66,7 @@ class _InterfacesDotYamlSpec(TypedDict): providers: List[_CharmTestConfig] requirers: List[_CharmTestConfig] - owner: str + owners: List[str] class _RoleTestSpec(TypedDict): @@ -82,7 +82,7 @@ class InterfaceTestSpec(TypedDict): provider: _RoleTestSpec requirer: _RoleTestSpec - owner: str + owners: List[str] def get_schema_from_module(module: object, name: str) -> Type[pydantic.BaseModel]: @@ -175,7 +175,7 @@ def _gather_charms_for_version(version_dir: Path) -> Optional[_InterfacesDotYaml providers = charms.get("providers", []) requirers = charms.get("requirers", []) - owner = charms.get("owner", "") + owners = charms.get("owners", "") if not isinstance(providers, list) or not isinstance(requirers, list): raise TypeError( @@ -202,7 +202,7 @@ def _gather_charms_for_version(version_dir: Path) -> Optional[_InterfacesDotYaml spec: _InterfacesDotYamlSpec = { "providers": provider_configs, "requirers": requirer_configs, - "owner": owner, + "owners": owners, } return spec @@ -277,7 +277,7 @@ def gather_test_spec_for_version( "schema": schemas.get("requirer"), "charms": charms.get("requirers", []) if charms else [], }, - "owner": charms.get("owner", "") if charms else "", + "owners": charms.get("owners", "") if charms else "", } From 716653edb571f4c208819484e60c4ddcf914f18e Mon Sep 17 00:00:00 2001 From: Tiexin Guo Date: Thu, 8 Aug 2024 13:56:30 +0800 Subject: [PATCH 4/5] chore: change get owners according to code review --- interface_tester/collector.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface_tester/collector.py b/interface_tester/collector.py index b405525..d38418f 100644 --- a/interface_tester/collector.py +++ b/interface_tester/collector.py @@ -175,7 +175,7 @@ def _gather_charms_for_version(version_dir: Path) -> Optional[_InterfacesDotYaml providers = charms.get("providers", []) requirers = charms.get("requirers", []) - owners = charms.get("owners", "") + owners = charms.get("owners") or [] if not isinstance(providers, list) or not isinstance(requirers, list): raise TypeError( @@ -277,7 +277,7 @@ def gather_test_spec_for_version( "schema": schemas.get("requirer"), "charms": charms.get("requirers", []) if charms else [], }, - "owners": charms.get("owners", "") if charms else "", + "owners": charms.get("owners") or [] if charms else [], } From 405db240a70a727ea0be9c0e3686966aceb9afad Mon Sep 17 00:00:00 2001 From: Tiexin Guo Date: Fri, 9 Aug 2024 09:24:28 +0800 Subject: [PATCH 5/5] chore: minor fix and version bump --- interface_tester/collector.py | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interface_tester/collector.py b/interface_tester/collector.py index d38418f..262c241 100644 --- a/interface_tester/collector.py +++ b/interface_tester/collector.py @@ -173,8 +173,8 @@ def _gather_charms_for_version(version_dir: Path) -> Optional[_InterfacesDotYaml if not charms: return None - providers = charms.get("providers", []) - requirers = charms.get("requirers", []) + providers = charms.get("providers") or [] + requirers = charms.get("requirers") or [] owners = charms.get("owners") or [] if not isinstance(providers, list) or not isinstance(requirers, list): diff --git a/pyproject.toml b/pyproject.toml index d9a5404..4b43cd6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ build-backend = "setuptools.build_meta" [project] name = "pytest-interface-tester" -version = "3.0.0" +version = "3.1.0" authors = [ { name = "Pietro Pasotti", email = "pietro.pasotti@canonical.com" }, ]