utils: centralise path asciification#6733
Conversation
|
Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry. |
There was a problem hiding this comment.
Pull request overview
PR move Unicode normalize + separator cleanup into beets.util.asciify_path() so path shaping live one place, and library model call util for asciify.
Changes:
- Change
util.asciify_path()signature to readpath_sep_replacefrom config and do platform Unicode normalization internally. - Update
Item.destination(),Album.art_destination(), andtmpl_asciify()to call newutil.asciify_path(subpath). - Move asciify-related tests out of
test/test_library.pyinto newTestAsciifyPathintest/test_util.py.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
beets/util/__init__.py |
Centralize Unicode normalization + separator replacement inside asciify_path(). |
beets/library/models.py |
Switch callers to new asciify_path() signature and remove in-function normalization code. |
test/test_library.py |
Remove destination/asciify tests that used to assert normalization behavior via Item.destination(). |
test/test_util.py |
Add direct tests for util.asciify_path() behavior. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6733 +/- ##
=======================================
Coverage 74.82% 74.83%
=======================================
Files 163 163
Lines 20969 20969
Branches 3302 3300 -2
=======================================
+ Hits 15691 15693 +2
+ Misses 4522 4521 -1
+ Partials 756 755 -1
🚀 New features to boost your workflow:
|
c1999ba to
335e512
Compare
semohr
left a comment
There was a problem hiding this comment.
Looks fine from my perspective. I think we lost a bit of test coverage here, maybe you want to check.
335e512 to
f7cce1f
Compare
- Move Unicode normalization and separator replacement into util.asciify_path. - Update library callers and relocate focused asciify tests to util coverage.
bc83804 to
8968648
Compare
|
Just fixed the coverage an expanded coverage of the function. |
This change moves path Unicode normalization and separator cleanup into
beets.util.asciify_path(), so path shaping now lives in one place instead of being split betweenbeets.library.modelsandutil.Callers in
Item.destination(),art_destination(), andtmpl_asciify()now use the sameutil.asciify_path()flow. This makes path generation more consistent and removes duplicate platform-specific normalization logic from the library layer.High-level impact: when
asciify_pathsis enabled, all asciified paths now get the same normalization, transliteration, and separator-replacement behavior through one shared utility. This should make path handling easier to reason about and safer to change later.Test coverage follows the architecture change: focused asciify behavior tests move from
test/test_library.pytotest/test_util.py, soasciify_path()is tested directly where the behavior now lives.