2020-04-05 22:50:52 +00:00
|
|
|
"""Configure Synology DSM tests."""
|
2021-01-01 21:31:56 +00:00
|
|
|
from unittest.mock import patch
|
2020-04-05 22:50:52 +00:00
|
|
|
|
2021-01-01 21:31:56 +00:00
|
|
|
import pytest
|
2020-05-03 18:27:19 +00:00
|
|
|
|
2020-04-05 22:50:52 +00:00
|
|
|
|
2020-11-16 10:18:48 +00:00
|
|
|
def pytest_configure(config):
|
|
|
|
"""Register custom marker for tests."""
|
|
|
|
config.addinivalue_line(
|
|
|
|
"markers", "no_bypass_setup: mark test to disable bypass_setup_fixture"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-05-06 22:15:49 +00:00
|
|
|
@pytest.fixture(name="bypass_setup", autouse=True)
|
2020-11-16 10:18:48 +00:00
|
|
|
def bypass_setup_fixture(request):
|
2020-04-05 22:50:52 +00:00
|
|
|
"""Mock component setup."""
|
2020-11-16 10:18:48 +00:00
|
|
|
if "no_bypass_setup" in request.keywords:
|
2020-04-05 22:50:52 +00:00
|
|
|
yield
|
2020-11-16 10:18:48 +00:00
|
|
|
else:
|
|
|
|
with patch(
|
|
|
|
"homeassistant.components.synology_dsm.async_setup_entry", return_value=True
|
|
|
|
):
|
|
|
|
yield
|