mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Skip RFXtrx tests unless RFXTRX=RUN (#3625)
* Skip RFXtrx tests unless RFXTRX=RUN * Remove my previous hacks to slightly speed up rfxtrx * Exclude RFXTRX tests from coverage * Remove unused import in rfxtrx tstt * Add close connection back to RFXtrx tests * Typo
This commit is contained in:
parent
892bbdc2dd
commit
3e24a35c1e
@ -49,6 +49,9 @@ omit =
|
|||||||
homeassistant/components/qwikswitch.py
|
homeassistant/components/qwikswitch.py
|
||||||
homeassistant/components/*/qwikswitch.py
|
homeassistant/components/*/qwikswitch.py
|
||||||
|
|
||||||
|
homeassistant/components/rfxtrx.py
|
||||||
|
homeassistant/components/*/rfxtrx.py
|
||||||
|
|
||||||
homeassistant/components/rpi_gpio.py
|
homeassistant/components/rpi_gpio.py
|
||||||
homeassistant/components/*/rpi_gpio.py
|
homeassistant/components/*/rpi_gpio.py
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from homeassistant.components import rfxtrx as rfxtrx_core
|
|||||||
from tests.common import get_test_home_assistant
|
from tests.common import get_test_home_assistant
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif("os.environ.get('RFXTRX') == 'SKIP'")
|
@pytest.mark.skipif("os.environ.get('RFXTRX') != 'RUN'")
|
||||||
class TestCoverRfxtrx(unittest.TestCase):
|
class TestCoverRfxtrx(unittest.TestCase):
|
||||||
"""Test the Rfxtrx cover platform."""
|
"""Test the Rfxtrx cover platform."""
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from homeassistant.components import rfxtrx as rfxtrx_core
|
|||||||
from tests.common import get_test_home_assistant
|
from tests.common import get_test_home_assistant
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif("os.environ.get('RFXTRX') == 'SKIP'")
|
@pytest.mark.skipif("os.environ.get('RFXTRX') != 'RUN'")
|
||||||
class TestLightRfxtrx(unittest.TestCase):
|
class TestLightRfxtrx(unittest.TestCase):
|
||||||
"""Test the Rfxtrx light platform."""
|
"""Test the Rfxtrx light platform."""
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ from homeassistant.components import rfxtrx as rfxtrx_core
|
|||||||
from tests.common import get_test_home_assistant
|
from tests.common import get_test_home_assistant
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif("os.environ.get('RFXTRX') == 'SKIP'")
|
@pytest.mark.skipif("os.environ.get('RFXTRX') != 'RUN'")
|
||||||
class TestRollershutterRfxtrx(unittest.TestCase):
|
class TestRollershutterRfxtrx(unittest.TestCase):
|
||||||
"""Test the Rfxtrx roller shutter platform."""
|
"""Test the Rfxtrx roller shutter platform."""
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ from homeassistant.const import TEMP_CELSIUS
|
|||||||
from tests.common import get_test_home_assistant
|
from tests.common import get_test_home_assistant
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif("os.environ.get('RFXTRX') == 'SKIP'")
|
@pytest.mark.skipif("os.environ.get('RFXTRX') != 'RUN'")
|
||||||
class TestSensorRfxtrx(unittest.TestCase):
|
class TestSensorRfxtrx(unittest.TestCase):
|
||||||
"""Test the Rfxtrx sensor platform."""
|
"""Test the Rfxtrx sensor platform."""
|
||||||
|
|
||||||
@ -23,6 +23,8 @@ class TestSensorRfxtrx(unittest.TestCase):
|
|||||||
"""Stop everything that was started."""
|
"""Stop everything that was started."""
|
||||||
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS = []
|
rfxtrx_core.RECEIVED_EVT_SUBSCRIBERS = []
|
||||||
rfxtrx_core.RFX_DEVICES = {}
|
rfxtrx_core.RFX_DEVICES = {}
|
||||||
|
if rfxtrx_core.RFXOBJECT:
|
||||||
|
rfxtrx_core.RFXOBJECT.close_connection()
|
||||||
self.hass.stop()
|
self.hass.stop()
|
||||||
|
|
||||||
def test_default_config(self):
|
def test_default_config(self):
|
||||||
|
@ -9,7 +9,7 @@ from homeassistant.components import rfxtrx as rfxtrx_core
|
|||||||
from tests.common import get_test_home_assistant
|
from tests.common import get_test_home_assistant
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif("os.environ.get('RFXTRX') == 'SKIP'")
|
@pytest.mark.skipif("os.environ.get('RFXTRX') != 'RUN'")
|
||||||
class TestSwitchRfxtrx(unittest.TestCase):
|
class TestSwitchRfxtrx(unittest.TestCase):
|
||||||
"""Test the Rfxtrx switch platform."""
|
"""Test the Rfxtrx switch platform."""
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
"""Th tests for the Rfxtrx component."""
|
"""The tests for the Rfxtrx component."""
|
||||||
# pylint: disable=too-many-public-methods,protected-access
|
# pylint: disable=too-many-public-methods,protected-access
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -10,7 +9,7 @@ from homeassistant.components import rfxtrx as rfxtrx
|
|||||||
from tests.common import get_test_home_assistant
|
from tests.common import get_test_home_assistant
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif("os.environ.get('RFXTRX') == 'SKIP'")
|
@pytest.mark.skipif("os.environ.get('RFXTRX') != 'RUN'")
|
||||||
class TestRFXTRX(unittest.TestCase):
|
class TestRFXTRX(unittest.TestCase):
|
||||||
"""Test the Rfxtrx component."""
|
"""Test the Rfxtrx component."""
|
||||||
|
|
||||||
@ -22,10 +21,11 @@ class TestRFXTRX(unittest.TestCase):
|
|||||||
"""Stop everything that was started."""
|
"""Stop everything that was started."""
|
||||||
rfxtrx.RECEIVED_EVT_SUBSCRIBERS = []
|
rfxtrx.RECEIVED_EVT_SUBSCRIBERS = []
|
||||||
rfxtrx.RFX_DEVICES = {}
|
rfxtrx.RFX_DEVICES = {}
|
||||||
|
if rfxtrx.RFXOBJECT:
|
||||||
|
rfxtrx.RFXOBJECT.close_connection()
|
||||||
self.hass.stop()
|
self.hass.stop()
|
||||||
|
|
||||||
@patch('RFXtrx.sleep')
|
def test_default_config(self):
|
||||||
def test_default_config(self, mock_sleep):
|
|
||||||
"""Test configuration."""
|
"""Test configuration."""
|
||||||
self.assertTrue(_setup_component(self.hass, 'rfxtrx', {
|
self.assertTrue(_setup_component(self.hass, 'rfxtrx', {
|
||||||
'rfxtrx': {
|
'rfxtrx': {
|
||||||
@ -41,8 +41,7 @@ class TestRFXTRX(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(len(rfxtrx.RFXOBJECT.sensors()), 2)
|
self.assertEqual(len(rfxtrx.RFXOBJECT.sensors()), 2)
|
||||||
|
|
||||||
@patch('RFXtrx.sleep')
|
def test_valid_config(self):
|
||||||
def test_valid_config(self, mock_sleep):
|
|
||||||
"""Test configuration."""
|
"""Test configuration."""
|
||||||
self.assertTrue(_setup_component(self.hass, 'rfxtrx', {
|
self.assertTrue(_setup_component(self.hass, 'rfxtrx', {
|
||||||
'rfxtrx': {
|
'rfxtrx': {
|
||||||
@ -71,8 +70,7 @@ class TestRFXTRX(unittest.TestCase):
|
|||||||
'-RFXCOM_RFXtrx433_A1Y0NJGR-if00-port0',
|
'-RFXCOM_RFXtrx433_A1Y0NJGR-if00-port0',
|
||||||
'invalid_key': True}}))
|
'invalid_key': True}}))
|
||||||
|
|
||||||
@patch('RFXtrx.sleep')
|
def test_fire_event(self):
|
||||||
def test_fire_event(self, mock_sleep):
|
|
||||||
"""Test fire event."""
|
"""Test fire event."""
|
||||||
self.assertTrue(_setup_component(self.hass, 'rfxtrx', {
|
self.assertTrue(_setup_component(self.hass, 'rfxtrx', {
|
||||||
'rfxtrx': {
|
'rfxtrx': {
|
||||||
@ -116,8 +114,7 @@ class TestRFXTRX(unittest.TestCase):
|
|||||||
self.assertEqual(calls[0].data,
|
self.assertEqual(calls[0].data,
|
||||||
{'entity_id': 'switch.test', 'state': 'on'})
|
{'entity_id': 'switch.test', 'state': 'on'})
|
||||||
|
|
||||||
@patch('RFXtrx.sleep')
|
def test_fire_event_sensor(self):
|
||||||
def test_fire_event_sensor(self, mock_sleep):
|
|
||||||
"""Test fire event."""
|
"""Test fire event."""
|
||||||
self.assertTrue(_setup_component(self.hass, 'rfxtrx', {
|
self.assertTrue(_setup_component(self.hass, 'rfxtrx', {
|
||||||
'rfxtrx': {
|
'rfxtrx': {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user