From 1421f4c124146b7d237cac21db430708c6929834 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis <jbouwh@users.noreply.github.com> Date: Wed, 15 Jan 2025 10:51:41 +0100 Subject: [PATCH] Set MQTT quality scale to platinum (#135612) * Set MQTT quality scale to platinum * Add test for type stub --- homeassistant/components/mqtt/manifest.json | 2 +- homeassistant/components/mqtt/quality_scale.yaml | 7 ++++--- script/hassfest/quality_scale_validation/strict_typing.py | 6 +++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/mqtt/manifest.json b/homeassistant/components/mqtt/manifest.json index 2e5b19b49a99e9..25e98c01aafe24 100644 --- a/homeassistant/components/mqtt/manifest.json +++ b/homeassistant/components/mqtt/manifest.json @@ -7,7 +7,7 @@ "dependencies": ["file_upload", "http"], "documentation": "https://www.home-assistant.io/integrations/mqtt", "iot_class": "local_push", - "quality_scale": "gold", + "quality_scale": "platinum", "requirements": ["paho-mqtt==1.6.1"], "single_config_entry": true } diff --git a/homeassistant/components/mqtt/quality_scale.yaml b/homeassistant/components/mqtt/quality_scale.yaml index c178147bf71aea..b17812acd91112 100644 --- a/homeassistant/components/mqtt/quality_scale.yaml +++ b/homeassistant/components/mqtt/quality_scale.yaml @@ -123,6 +123,7 @@ rules: comment: | This integration does not use web sessions. strict-typing: - status: todo - comment: | - Requirement 'paho-mqtt==1.6.1' appears untyped + status: done + comment: > + Typing for 'paho-mqtt==1.6.1' supported via 'types-paho-mqtt==1.6.0.20240321' + (requirements_test.txt). diff --git a/script/hassfest/quality_scale_validation/strict_typing.py b/script/hassfest/quality_scale_validation/strict_typing.py index c1373032ff8ca9..1f5a5665835651 100644 --- a/script/hassfest/quality_scale_validation/strict_typing.py +++ b/script/hassfest/quality_scale_validation/strict_typing.py @@ -43,7 +43,11 @@ def _check_requirements_are_typed(integration: Integration) -> list[str]: if not any(file for file in distribution.files if file.name == "py.typed"): # no py.typed file - invalid_requirements.append(requirement) + try: + metadata.distribution(f"types-{requirement_name}") + except metadata.PackageNotFoundError: + # also no stubs-only package + invalid_requirements.append(requirement) return invalid_requirements