Test the socket interaction by mocking the socket
This provides almost 100% coverage of __init__.py. I am not sure about the missing lines. Sockets are weird, in particular checking whether a socket is closed / no longer usable.
Also the struct.error is not sensible in my opinion, but this should be discussed elsewhere.
Edit: And with the tests, I found a typo :)
Coverage Report
File Stmts Miss Cover Missing luxtronik __init__.py 181 14 92% 42–43, 46–51, 210–212, 229–231, 246–248 __main__.py 21 21 0% 3–49 datatypes.py 275 1 99% 82 discover.py 40 34 15% 21–69 luxtronik/scripts dump_changes.py 44 44 0% 5–85 dump_luxtronik.py 27 27 0% 5–52 TOTAL 675 141 79%
| Tests | Skipped | Failures | Errors | Time |
|---|---|---|---|---|
| 124 | 0 :zzz: | 0 :x: | 0 :fire: | 3.969s :stopwatch: |
Nice 😎
I was tempted to implement tests for __init__.py but failed on mocking socket.socket, good work @gerw