mirror of
https://github.com/esphome/esphome.git
synced 2026-08-23 06:36:23 +00:00
19 lines
437 B
Python
19 lines
437 B
Python
"""Shared fixtures for core unit tests."""
|
|
|
|
from collections.abc import Callable
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def yaml_file(tmp_path: Path) -> Callable[[str], Path]:
|
|
"""Create a temporary YAML file for testing."""
|
|
|
|
def _yaml_file(content: str) -> Path:
|
|
yaml_path = tmp_path / "test.yaml"
|
|
yaml_path.write_text(content, encoding="utf-8")
|
|
return yaml_path
|
|
|
|
return _yaml_file
|