Bouni / python-luxtronik

python-luxtronik is a library that allow you to interact with a Luxtronik heatpump controller.
MIT License
37 stars 19 forks source link

Test the socket interaction by mocking the socket #172

Open gerw opened 5 months ago

gerw commented 5 months ago

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 :)

github-actions[bot] commented 5 months ago

Coverage

Coverage Report
FileStmtsMissCoverMissing
luxtronik
   __init__.py1811492%42–43, 46–51, 210–212, 229–231, 246–248
   __main__.py21210%3–49
   datatypes.py275199%82
   discover.py403415%21–69
luxtronik/scripts
   dump_changes.py44440%5–85
   dump_luxtronik.py27270%5–52
TOTAL67514179% 

Tests Skipped Failures Errors Time
124 0 :zzz: 0 :x: 0 :fire: 3.969s :stopwatch:
Bouni commented 5 months ago

Nice 😎

I was tempted to implement tests for __init__.py but failed on mocking socket.socket, good work @gerw