use pathlib in tests: make _common.RSRC a pathlib.Path#6850
Open
snejus wants to merge 1 commit into
Open
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. |
snejus
force-pushed
the
keep-path-based-properties-in-helpers
branch
from
July 16, 2026 16:36
1e5cb96 to
d0844f4
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6850 +/- ##
==========================================
- Coverage 75.63% 75.62% -0.01%
==========================================
Files 163 163
Lines 21317 21317
Branches 3361 3361
==========================================
- Hits 16124 16122 -2
- Misses 4403 4404 +1
- Partials 790 791 +1 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
grug see PR try make test resource path _common.RSRC be pathlib.Path, so tests stop juggling bytes/str/os.path and use /, .open(), .read_bytes(), .stat(), etc.
Changes:
- make
beets/test/_common.py::RSRCbePathand adjustPLUGINPATHto string - update many tests to build resource paths via
RSRC / "file.ext"and usePathhelpers - remove some old bytes-path glue in tests
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| beets/test/_common.py | redefine RSRC as Path and adjust plugin path string |
| beets/test/helper.py | use RSRC Path in fixtures (but one place still assigns Path into byte-only Item["path"]) |
| test/util/test_m3ufile.py | use RSRC / ... for playlist fixtures |
| test/util/test_art_resize.py | use Path for image fixture constant |
| test/ui/commands/test_utils.py | simplify copy of resource media file using Path |
| test/ui/commands/test_update.py | use Path for resource media inputs |
| test/ui/commands/test_completion.py | load completion script via Path.open() |
| test/test_library.py | use Path resource for unreadable file and unicode-path test (but .path assignment needs bytes) |
| test/test_importer.py | use Path resource joins in importer tests (but importer.paths overwrites must stay bytes) |
| test/plugins/test_web.py | use Path for resource media and URL path construction |
| test/plugins/test_spotify.py | read mock JSON via Path.read_bytes() |
| test/plugins/test_replace.py | remove .decode() and use RSRC Path directly |
| test/plugins/test_plugin_mediafield.py | use RSRC Path when copying fixture file |
| test/plugins/test_metasync.py | use RSRC Path for itunes xml fixtures |
| test/plugins/test_embedart.py | switch art fixture paths to Path and simplify display string |
| test/plugins/test_convert.py | switch convert stub/art paths to Path (but .artpath assignment must stay bytes) |
| test/plugins/test_art.py | switch some fixture paths to Path (linked issue says this file was scope-exempt) |
| test/plugins/test_acousticbrainz.py | load JSON via Path.read_text() + json.loads() |
snejus
force-pushed
the
keep-path-based-properties-in-helpers
branch
from
July 17, 2026 09:53
d0844f4 to
34ef4b0
Compare
snejus
force-pushed
the
make-rsrc-pathlib-path
branch
from
July 17, 2026 09:54
97c01e1 to
9e54dce
Compare
snejus
force-pushed
the
keep-path-based-properties-in-helpers
branch
from
July 21, 2026 00:19
34ef4b0 to
b22c194
Compare
snejus
force-pushed
the
make-rsrc-pathlib-path
branch
from
July 21, 2026 00:19
9e54dce to
0757fb3
Compare
snejus
force-pushed
the
keep-path-based-properties-in-helpers
branch
from
July 21, 2026 10:15
b22c194 to
bb0e6bb
Compare
snejus
force-pushed
the
make-rsrc-pathlib-path
branch
from
July 21, 2026 10:15
0757fb3 to
6a4f3fc
Compare
snejus
force-pushed
the
make-rsrc-pathlib-path
branch
from
July 21, 2026 12:06
6a4f3fc to
674758f
Compare
snejus
force-pushed
the
make-rsrc-pathlib-path
branch
from
July 21, 2026 15:24
674758f to
bfd3b7e
Compare
semohr
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #6807
What changed
_common.RSRCapathlib.Pathinstead of a bytes path./and usesPathhelpers likeread_text(),read_bytes(),open(),stat(), andresolve().beets/test/_common.pyis simplified, and old byte-string path conversions are removed from many tests.Why
os.path, byte paths, string decoding, and utility conversions.Pathobjects.