commitizen icon indicating copy to clipboard operation
commitizen copied to clipboard

fix(cmd): improve character encoding detection for sub-commands

Open jenstroeger opened this issue 3 years ago • 6 comments

Description

Fixes #544 Redo #545

Checklist

  • [ ] Add test cases to all the changes you introduce
  • [X] Run ./scripts/format and ./scripts/test locally to ensure this change passes linter check and test
  • [X] Test the changes on the local machine manually
  • [ ] Update the documentation for the changes

Expected behavior

See issue #544: cz now creates the changelog without failing

jenstroeger avatar Aug 09 '22 11:08 jenstroeger

Codecov Report

Merging #552 (48a82a8) into master (764861f) will increase coverage by 0.01%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #552      +/-   ##
==========================================
+ Coverage   98.25%   98.27%   +0.01%     
==========================================
  Files          39       39              
  Lines        1551     1566      +15     
==========================================
+ Hits         1524     1539      +15     
  Misses         27       27              
Flag Coverage Δ
unittests 98.27% <100.00%> (+0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
commitizen/cmd.py 100.00% <100.00%> (ø)
commitizen/exceptions.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Aug 09 '22 11:08 codecov[bot]

Lgtm, what's missing?

woile avatar Aug 09 '22 11:08 woile

Functionally nothing, testionally coverage 🤓

jenstroeger avatar Aug 09 '22 11:08 jenstroeger

Do you need help with the tests? Let me know I can give a hand ✋🏻

woile avatar Aug 11 '22 07:08 woile

@Woile weekend I might have some time. Which one of the tests do you suggest should host them—maybe test_cli.py?

jenstroeger avatar Aug 11 '22 07:08 jenstroeger

You can create a new tests/test_cmd.py and add the different variations for _try_decode. I would test:

  • success utf-8
  • success char detection
  • failure char detection

woile avatar Aug 11 '22 07:08 woile

Thanks a lot for solving this issue 🚀

woile avatar Aug 13 '22 08:08 woile