-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
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 Whirlpool sensor tests #142437
base: dev
Are you sure you want to change the base?
Refactor Whirlpool sensor tests #142437
Conversation
Hey there @mkmer, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.
Files not reviewed (2)
- tests/components/whirlpool/snapshots/test_diagnostics.ambr: Language not supported
- tests/components/whirlpool/snapshots/test_sensor.ambr: Language not supported
'unit_of_measurement': None, | ||
}) | ||
# --- | ||
# name: test_all_entities[sensor.dryer_none-state] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dryer_none?
@pytest.fixture | ||
def entity_registry_enabled_by_default() -> Generator[None]: | ||
"""Test fixture that ensures entities are enabled in the registry.""" | ||
with mock.patch( | ||
"homeassistant.components.whirlpool.sensor.WhirlpoolSensor.entity_registry_enabled_default", | ||
return_value=True, | ||
): | ||
yield |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one already exists
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
Proposed change
This is a full rewrite of the sensor platform tests in an attempt to make them easier to maintain and support new sensors in the future.
mock_sensor*
fixtures, tomock_washer
andmock_dryer
since in the future other types of appliances may have sensors too.These changes should also make it easier to add and test new sensors if they are simple, since only snapshots need to be updated.
Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: