Fix tests and add setup type in feedreader (#64280)

* Fix feedreader tests

* Cleanup

* Add setup type hints

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2022-01-17 09:42:00 +01:00 committed by GitHub
parent 85c6a24665
commit b9d3bb4cfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 15 deletions

View file

@ -1,9 +1,7 @@
"""The tests for the feedreader component."""
from datetime import timedelta
from os import remove
from os.path import exists
from unittest import mock
from unittest.mock import patch
from unittest.mock import mock_open, patch
import pytest
@ -65,14 +63,10 @@ async def fixture_events(hass):
@pytest.fixture(name="feed_storage", autouse=True)
def fixture_feed_storage(hass):
"""Create storage account for feedreader."""
data_file = hass.config.path(f"{feedreader.DOMAIN}.pickle")
yield
if exists(data_file):
remove(data_file)
def fixture_feed_storage():
"""Mock builtins.open for feedreader storage."""
with patch("homeassistant.components.feedreader.open", mock_open(), create=True):
yield
async def test_setup_one_feed(hass):