palazzem / econnect-python

API adapter used to control programmatically an Elmo alarm system
BSD 3-Clause "New" or "Revised" License
8 stars 5 forks source link

[core/client] Ensure unlock() is called even if an exception is raised in the block #66

Closed palazzem closed 3 years ago

palazzem commented 3 years ago

Overview

Closes #56

With the previous behavior, any kind of exception raised in a with client.lock(code): block was preventing the Lock() from being released. The change ensures that unlock() is called in any case, behaving as a try-finally block.

codecov-io commented 3 years ago

Codecov Report

Merging #66 (05d6516) into master (221cd7c) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #66   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          226       227    +1     
=========================================
+ Hits           226       227    +1     
Impacted Files Coverage Δ
elmo/api/client.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 221cd7c...05d6516. Read the comment docs.