agronholm / agronholm/mqttproto
Connection failure doesn't raise an exception
- Lingua principale
- Python
- Stelle
- 23
- Fork
- 6
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I'm running pytest against my server which happens to require a login.
As the connection didn't succeed I'd expect the `async with AsyncMQTTClient()` call to raise an appropriate exception instead of continuing.
```
-> async def _run_operation(self, operation: MQTTOperation[Any]) -> None:
(Pdb) b 481
Breakpoint 1 at /src/mqttproto/src/mqttproto/async_client.py:481
(Pdb) c
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB continue >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /src/mqttproto/src/mqttproto/async_client.py(481)_run_operation()
-> if operation.exception:
(Pdb) p operation.exception
None
(Pdb) p operation.response.reason_code
(Pdb) c
………
| Traceback (most recent call last):
| File "/src/mqttproto/tests/test_async_client.py", line 14, in test_publish_subscribe
| async with client.subscribe("test/+") as messages:
…
| mqttproto.MQTTProtocolError: cannot perform this operation in the DISCONNECTED state (must be in one of the following states: CONNECTED)
```
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.