Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ef80033

Browse files
authored
Enable Ruff PT022 (home-assistant#86792)
* Enable Ruff PT022 * Adjust found cases
1 parent 8c99311 commit ef80033

File tree

50 files changed

+79
-88
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+79
-88
lines changed

‎tests/components/airvisual/conftest.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,3 @@ async def setup_config_entry_fixture(hass, config_entry, mock_pyairvisual):
141141
"""Define a fixture to set up airvisual."""
142142
assert await hass.config_entries.async_setup(config_entry.entry_id)
143143
await hass.async_block_till_done()
144-
yield

‎tests/components/aladdin_connect/conftest.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ def fixture_mock_aladdinconnect_api():
4040
mock_opener.open_door = AsyncMock(return_value=True)
4141
mock_opener.close_door = AsyncMock(return_value=True)
4242

43-
yield mock_opener
43+
return mock_opener

‎tests/components/ambient_station/conftest.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,3 @@ async def setup_config_entry_fixture(hass, config_entry, mock_aioambient):
6060
"""Define a fixture to set up ambient_station."""
6161
assert await hass.config_entries.async_setup(config_entry.entry_id)
6262
await hass.async_block_till_done()
63-
yield

‎tests/components/apple_tv/conftest.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def full_device(mock_scan, dmap_pin):
9292
airplay_service(),
9393
)
9494
)
95-
yield mock_scan
95+
return mock_scan
9696

9797

9898
@pytest.fixture
@@ -112,7 +112,7 @@ def mrp_device(mock_scan):
112112
),
113113
]
114114
)
115-
yield mock_scan
115+
return mock_scan
116116

117117

118118
@pytest.fixture
@@ -132,7 +132,7 @@ def airplay_with_disabled_mrp(mock_scan):
132132
),
133133
)
134134
)
135-
yield mock_scan
135+
return mock_scan
136136

137137

138138
@pytest.fixture
@@ -152,7 +152,7 @@ def dmap_device(mock_scan):
152152
),
153153
)
154154
)
155-
yield mock_scan
155+
return mock_scan
156156

157157

158158
@pytest.fixture
@@ -172,7 +172,7 @@ def dmap_device_with_credentials(mock_scan):
172172
),
173173
)
174174
)
175-
yield mock_scan
175+
return mock_scan
176176

177177

178178
@pytest.fixture
@@ -187,7 +187,7 @@ def airplay_device_with_password(mock_scan):
187187
),
188188
)
189189
)
190-
yield mock_scan
190+
return mock_scan
191191

192192

193193
@pytest.fixture
@@ -206,4 +206,4 @@ def dmap_with_requirement(mock_scan, pairing_requirement):
206206
),
207207
)
208208
)
209-
yield mock_scan
209+
return mock_scan

‎tests/components/axis/conftest.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def __mock_default_requests(host):
154154
)
155155
respx.post(f"{path}/local/vmd/control.cgi").respond(json=VMD4_RESPONSE)
156156

157-
yield __mock_default_requests
157+
return __mock_default_requests
158158

159159

160160
@pytest.fixture
@@ -187,15 +187,15 @@ async def __mock_setup_config_entry():
187187
await hass.async_block_till_done()
188188
return config_entry
189189

190-
yield __mock_setup_config_entry
190+
return __mock_setup_config_entry
191191

192192

193193
@pytest.fixture(name="setup_config_entry")
194194
async def setup_config_entry_fixture(hass, config_entry, setup_default_vapix_requests):
195195
"""Define a fixture to set up Axis network device."""
196196
assert await hass.config_entries.async_setup(config_entry.entry_id)
197197
await hass.async_block_till_done()
198-
yield config_entry
198+
return config_entry
199199

200200

201201
# RTSP fixtures
@@ -283,7 +283,7 @@ def send_event(
283283

284284
mock_axis_rtspclient(data=event.encode("utf-8"))
285285

286-
yield send_event
286+
return send_event
287287

288288

289289
@pytest.fixture(autouse=True)
@@ -295,4 +295,4 @@ def send_signal(connected: bool) -> None:
295295
signal = Signal.PLAYING if connected else Signal.FAILED
296296
mock_axis_rtspclient(state=signal)
297297

298-
yield send_signal
298+
return send_signal

‎tests/components/blebox/test_config_flow.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def product_class_mock_fixture():
8484
"""Return a mocked feature."""
8585
path = "homeassistant.components.blebox.config_flow.Box"
8686
patcher = patch(path, DEFAULT, blebox_uniapi.box.Box, True, True)
87-
yield patcher
87+
return patcher
8888

8989

9090
async def test_flow_with_connection_failure(hass, product_class_mock):

‎tests/components/config/test_area_registry.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
def client(hass, hass_ws_client):
1212
"""Fixture that can interact with the config manager API."""
1313
hass.loop.run_until_complete(area_registry.async_setup(hass))
14-
yield hass.loop.run_until_complete(hass_ws_client(hass))
14+
return hass.loop.run_until_complete(hass_ws_client(hass))
1515

1616

1717
@pytest.fixture

‎tests/components/config/test_device_registry.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
def client(hass, hass_ws_client):
1919
"""Fixture that can interact with the config manager API."""
2020
hass.loop.run_until_complete(device_registry.async_setup(hass))
21-
yield hass.loop.run_until_complete(hass_ws_client(hass))
21+
return hass.loop.run_until_complete(hass_ws_client(hass))
2222

2323

2424
@pytest.fixture

‎tests/components/config/test_entity_registry.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
def client(hass, hass_ws_client):
2727
"""Fixture that can interact with the config manager API."""
2828
hass.loop.run_until_complete(entity_registry.async_setup(hass))
29-
yield hass.loop.run_until_complete(hass_ws_client(hass))
29+
return hass.loop.run_until_complete(hass_ws_client(hass))
3030

3131

3232
@pytest.fixture

‎tests/components/energy/test_sensor.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async def setup_integration(hass):
5757
@freeze_time("2022年04月19日 07:53:05")
5858
def frozen_time():
5959
"""Freeze clock for tests."""
60-
yield
60+
return
6161

6262

6363
def get_statistics_for_entity(statistics_results, entity_id):

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /