Add agent instructions to prefer usefixtures (#170458)

This commit is contained in:
Abílio Costa
2026-05-13 03:01:26 +01:00
committed by GitHub
parent d5d56e6e23
commit 894ee88033
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -30,6 +30,7 @@ This repository contains the core of Home Assistant, a Python 3 based home autom
- When writing or modifying tests, ensure all test function parameters have type annotations.
- Prefer concrete types (for example, `HomeAssistant`, `MockConfigEntry`, etc.) over `Any`.
- Prefer `@pytest.mark.usefixtures` over arguments, if the argument is not going to be used.
- Avoid using conditions/branching in tests. Instead, either split tests or adjust the test parametrization to cover all cases without branching.
- If multiple tests share most of their code, use `pytest.mark.parametrize` to merge them into a single parameterized test instead of duplicating the body.