Fix consider-using-with pylint warnings in matrix tests (#119365)
This commit is contained in:
parent
2e9f63ced6
commit
e14146d7c9
1 changed files with 5 additions and 4 deletions
|
@ -24,6 +24,7 @@ from nio import (
|
|||
)
|
||||
from PIL import Image
|
||||
import pytest
|
||||
from typing_extensions import Generator
|
||||
|
||||
from homeassistant.components.matrix import (
|
||||
CONF_COMMANDS,
|
||||
|
@ -305,9 +306,9 @@ def command_events(hass: HomeAssistant):
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
def image_path(tmp_path: Path):
|
||||
def image_path(tmp_path: Path) -> Generator[tempfile._TemporaryFileWrapper]:
|
||||
"""Provide the Path to a mock image."""
|
||||
image = Image.new("RGBA", size=(50, 50), color=(256, 0, 0))
|
||||
image_file = tempfile.NamedTemporaryFile(dir=tmp_path)
|
||||
image.save(image_file, "PNG")
|
||||
return image_file
|
||||
with tempfile.NamedTemporaryFile(dir=tmp_path) as image_file:
|
||||
image.save(image_file, "PNG")
|
||||
yield image_file
|
||||
|
|
Loading…
Add table
Reference in a new issue