Skip to content

Commit 7a83ad5

Browse files
authored
Update test_charge_point.py
1 parent 6b5ccc7 commit 7a83ad5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/test_charge_point.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,18 @@ async def test_cms_responses(hass):
4444
cp = ChargePoint("CP_1_test", ws)
4545
loop = True
4646
while loop:
47-
await asyncio.gather(
47+
out = await asyncio.gather(
4848
cp.start(),
4949
cp.send_boot_notification(),
5050
cp.send_start_transaction(),
5151
cp.send_meter_data(),
5252
cp.send_stop_transaction(),
5353
)
54-
await asyncio.sleep(10)
55-
loop = False
54+
if ws.closed:
55+
ws = websockets.connect("ws://localhost:9000/CP_1", subprotocols=["ocpp1.6"], close_timeout = 10)
56+
await asyncio.sleep(1)
57+
if out.done():
58+
loop = False
5659

5760
class ChargePoint(cpclass):
5861
"""Representation of real client Charge Point."""

0 commit comments

Comments
 (0)