Reduce time to run zha discover tests (#37424)

Most of the time was registering services and patching
the clusters which are never calls in these tests
This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-07-03 12:57:04 -05:00
1 parent 573134fcb4
commit ab6d6ac1ce
3 files changed
+44 -22

No files matched your search

+6 -4
View File
@@ -34,18 +34,20 @@ class FakeEndpoint:
self.device_type = None
self.request = AsyncMock(return_value=[0])
def add_input_cluster(self, cluster_id):
def add_input_cluster(self, cluster_id, _patch_cluster=True):
"""Add an input cluster."""
cluster = zigpy.zcl.Cluster.from_id(self, cluster_id, is_server=True)
patch_cluster(cluster)
if _patch_cluster:
patch_cluster(cluster)
self.in_clusters[cluster_id] = cluster
if hasattr(cluster, "ep_attribute"):
setattr(self, cluster.ep_attribute, cluster)
def add_output_cluster(self, cluster_id):
def add_output_cluster(self, cluster_id, _patch_cluster=True):
"""Add an output cluster."""
cluster = zigpy.zcl.Cluster.from_id(self, cluster_id, is_server=False)
patch_cluster(cluster)
if _patch_cluster:
patch_cluster(cluster)
self.out_clusters[cluster_id] = cluster
reply = AsyncMock(return_value=[0])