Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor MQTT tests to use modern platform schema part 1 #77387

Merged
merged 14 commits into from
Sep 6, 2022

Conversation

jbouwh
Copy link
Contributor

@jbouwh jbouwh commented Aug 26, 2022

Proposed change

The tests for the MQTT schema rely mainly on yaml the deprecated platform schema. When this is going to be removed with HA 2022.12.0 we need to update the tests to use the modern schema.
This PR will be the start of adopting the the modern schema.

For al platform tests a new DEFAULT_CONFIG will be defined, a clone without the platform attribute.
DEFAULT_CONFIG_LEGACY will hold the default config for the deprecated schema.
A new test will be added temporary to still test setup with the deprecated schema: test_setup_with_legacy_schema.
So all (common)tests that are not converted yet to the new schema will use DEFAULT_CONFIG_LEGACY config until the common code is migrated.
I'll use one commit per platform to begin with. Common tests will be updated later. Finally when the support for config under the platform key is removed all tests referring to the old schema will be labeled with deprecation comment.

Part 1 covers the specific platform tests (see changed files) and tests from test_init.py.
Part 2 will cover the other platforms: #77525

A PR for the common tests can be found here: #77583

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link

Hey there @emontnemery, mind taking a look at this pull request as it has been labeled with an integration (mqtt) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@jbouwh jbouwh marked this pull request as draft August 26, 2022 22:02
@jbouwh jbouwh removed the small-pr PRs with less than 30 lines. label Aug 26, 2022
@jbouwh jbouwh changed the title Refactor MQTT tests to use modern platform schema Refactor MQTT tests to use modern platform schema part 1 Aug 29, 2022
@jbouwh jbouwh marked this pull request as ready for review August 29, 2022 20:15
@jbouwh jbouwh force-pushed the mqtt-tests-modern-yaml branch from bad1c3b to c092ab7 Compare August 30, 2022 19:53
@jbouwh jbouwh force-pushed the mqtt-tests-modern-yaml branch from b8afe89 to b1eb85f Compare September 3, 2022 07:44
tests/components/mqtt/test_alarm_control_panel.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_alarm_control_panel.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_binary_sensor.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_binary_sensor.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_button.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_init.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_init.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_init.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_legacy_vacuum.py Outdated Show resolved Hide resolved
tests/components/mqtt/test_legacy_vacuum.py Outdated Show resolved Hide resolved
@jbouwh jbouwh merged commit a479299 into home-assistant:dev Sep 6, 2022
@jbouwh jbouwh deleted the mqtt-tests-modern-yaml branch September 6, 2022 09:02
@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2022
@jbouwh jbouwh added this to the 2022.9.6 milestone Sep 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants