use ProtocolIfc class

This commit is contained in:
Stefan Allius
2024-10-05 21:11:42 +02:00
parent c7d0a91371
commit 9852f44dfa
7 changed files with 108 additions and 154 deletions

View File

@@ -10,8 +10,7 @@ from app.src.config import Config
from app.src.gen3.talent import Talent
from app.src.inverter_base import InverterBase
from app.src.singleton import Singleton
from app.src.protocol_ifc import ProtocolIfcImpl
from app.src.async_stream import AsyncStream, AsyncIfcImpl, AsyncStreamClient
from app.src.async_stream import AsyncStream, AsyncStreamClient
from app.tests.test_modbus_tcp import patch_mqtt_err, patch_mqtt_except, test_port, test_hostname
@@ -114,20 +113,6 @@ def patch_unhealthy_remote():
with patch.object(AsyncStreamClient, 'healthy', new_healthy) as conn:
yield conn
def test_protocol_iter():
ProtocolIfcImpl._registry.clear()
cnt = 0
ifc = AsyncIfcImpl()
prot = ProtocolIfcImpl(('test.intern', 123), ifc, True)
for p in ProtocolIfcImpl:
assert p == prot
cnt += 1
del p
del prot
assert cnt == 1
for p in ProtocolIfcImpl:
assert False
def test_inverter_iter():
InverterBase._registry.clear()
cnt = 0