Exclude tests in dependencies in test dir from pytest (#2618)
This commit is contained in:
1 parent
4195254280
commit
8ee4503d7c
6 files changed
+4
-3
No files matched your search
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
Provide a mock switch platform.
|
||||
|
||||
Call init before using it in your tests to ensure clean test data.
|
||||
"""
|
||||
from homeassistant.const import STATE_ON, STATE_OFF
|
||||
from tests.common import MockToggleDevice
|
||||
|
||||
|
||||
DEVICES = []
|
||||
|
||||
|
||||
def init(empty=False):
|
||||
"""Initalize the platform with devices."""
|
||||
global DEVICES
|
||||
|
||||
DEVICES = [] if empty else [
|
||||
MockToggleDevice('AC', STATE_ON),
|
||||
MockToggleDevice('AC', STATE_OFF),
|
||||
MockToggleDevice(None, STATE_OFF)
|
||||
]
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices_callback, discovery_info=None):
|
||||
"""Find and return test switches."""
|
||||
add_devices_callback(DEVICES)
|
||||
Reference in new issue
Block a user