mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
Set cv hass in hass fixture (#77271)
* Set cv hass in hass fixture * Move test_hass_cv and update docstring * Update tests/test_test_fixtures.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
@@ -4,6 +4,8 @@ import socket
|
||||
import pytest
|
||||
import pytest_socket
|
||||
|
||||
from homeassistant.core import async_get_hass
|
||||
|
||||
|
||||
def test_sockets_disabled():
|
||||
"""Test we can't open sockets."""
|
||||
@@ -16,3 +18,12 @@ def test_sockets_enabled(socket_enabled):
|
||||
mysocket = socket.socket()
|
||||
with pytest.raises(pytest_socket.SocketConnectBlockedError):
|
||||
mysocket.connect(("127.0.0.2", 1234))
|
||||
|
||||
|
||||
async def test_hass_cv(hass):
|
||||
"""Test hass context variable.
|
||||
|
||||
When tests are using the `hass`, this tests that the hass context variable was set
|
||||
in the fixture and that async_get_hass() works correctly.
|
||||
"""
|
||||
assert async_get_hass() is hass
|
||||
|
||||
Reference in New Issue
Block a user