dalibo / pgtoolkit

Postgres Support from Python
https://pgtoolkit.rtfd.io/
PostgreSQL License
21 stars 9 forks source link

Only bypass write of empty pgpass if it was already empty #100

Closed dlax closed 2 years ago

dlax commented 2 years ago

This fixes up commit aa90611456aec0d8a0d82b91b6e329af4b051dbd which wrongly bypassed write of the pgpass when it had no entry thus breaking a use case where passfile's entries would be cleared, as evidenced in added tests here.

We thus move the check for empty 'lines' after the check for non-existence of the file path.

(Should fix failed pipeline at https://gitlab.com/dalibo/pglift/-/merge_requests/362)

codecov-commenter commented 2 years ago

Codecov Report

Merging #100 (00b4f57) into master (8150fcd) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #100   +/-   ##
=======================================
  Coverage   98.46%   98.46%           
=======================================
  Files          10       10           
  Lines        1110     1110           
=======================================
  Hits         1093     1093           
  Misses         17       17           
Impacted Files Coverage Δ
pgtoolkit/pgpass.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 8150fcd...00b4f57. Read the comment docs.