mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Clean up some Python 3.4 remnants (#14433)
This commit is contained in:
parent
e5d714ef52
commit
146a9492ec
@ -126,11 +126,7 @@ class LogErrorHandler(logging.Handler):
|
|||||||
if record.levelno >= logging.WARN:
|
if record.levelno >= logging.WARN:
|
||||||
stack = []
|
stack = []
|
||||||
if not record.exc_info:
|
if not record.exc_info:
|
||||||
try:
|
|
||||||
stack = [f for f, _, _, _ in traceback.extract_stack()]
|
stack = [f for f, _, _, _ in traceback.extract_stack()]
|
||||||
except ValueError:
|
|
||||||
# On Python 3.4 under py.test getting the stack might fail.
|
|
||||||
pass
|
|
||||||
|
|
||||||
entry = self._create_entry(record, stack)
|
entry = self._create_entry(record, stack)
|
||||||
self.records.appendleft(entry)
|
self.records.appendleft(entry)
|
||||||
|
@ -2,10 +2,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
# Using third party package because of a bug reading binary data in Python 3.4
|
|
||||||
# https://bugs.python.org/issue23004
|
|
||||||
from mock_open import MockOpen
|
|
||||||
|
|
||||||
from homeassistant.components.camera import DOMAIN
|
from homeassistant.components.camera import DOMAIN
|
||||||
from homeassistant.components.camera.local_file import (
|
from homeassistant.components.camera.local_file import (
|
||||||
SERVICE_UPDATE_FILE_PATH)
|
SERVICE_UPDATE_FILE_PATH)
|
||||||
@ -30,7 +26,7 @@ def test_loading_file(hass, aiohttp_client):
|
|||||||
|
|
||||||
client = yield from aiohttp_client(hass.http.app)
|
client = yield from aiohttp_client(hass.http.app)
|
||||||
|
|
||||||
m_open = MockOpen(read_data=b'hello')
|
m_open = mock.mock_open(read_data=b'hello')
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
'homeassistant.components.camera.local_file.open',
|
'homeassistant.components.camera.local_file.open',
|
||||||
m_open, create=True
|
m_open, create=True
|
||||||
@ -90,7 +86,7 @@ def test_camera_content_type(hass, aiohttp_client):
|
|||||||
client = yield from aiohttp_client(hass.http.app)
|
client = yield from aiohttp_client(hass.http.app)
|
||||||
|
|
||||||
image = 'hello'
|
image = 'hello'
|
||||||
m_open = MockOpen(read_data=image.encode())
|
m_open = mock.mock_open(read_data=image.encode())
|
||||||
with mock.patch('homeassistant.components.camera.local_file.open',
|
with mock.patch('homeassistant.components.camera.local_file.open',
|
||||||
m_open, create=True):
|
m_open, create=True):
|
||||||
resp_1 = yield from client.get('/api/camera_proxy/camera.test_jpg')
|
resp_1 = yield from client.get('/api/camera_proxy/camera.test_jpg')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user