playlist: refactor tests#6819
Open
snejus wants to merge 8 commits 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. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #6819 +/- ##
==========================================
- Coverage 74.85% 74.83% -0.02%
==========================================
Files 163 163
Lines 20970 20986 +16
Branches 3300 3304 +4
==========================================
+ Hits 15697 15705 +8
- Misses 4519 4523 +4
- Partials 754 758 +4
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
grug see this PR make playlist plugin tests use pathlib.Path more, and share setup helpers so test code repeat less.
Changes:
- move many test-owned paths to
Pathobjects and compose with/ - centralize playlist file writing in base test case (
write_absolute_playlist,write_relative_playlist) - simplify library seed data by using
self.add_album(...)loop
265fa0e to
85a30f6
Compare
414fe59 to
230bf19
Compare
85a30f6 to
7a8c529
Compare
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.
Refactors
test/plugins/test_playlist.pyto usepathlib.Pathas the main path abstraction instead of building paths manually withos.path.join.Centralizes playlist test setup by introducing shared helpers like
write_absolute_playlist(),write_relative_playlist(), and reusable path attributes such asc_track_pathandnonexisting_track_path.Simplifies fixture data creation by using
self.add_album(...)in a small loop instead of constructing test items manually.Architecturally, this change makes the test base class responsible for common path definitions, playlist file generation, and initial library setup. The individual test classes now mostly declare only the
playlistconfiguration they care about.High-level impact: the playlist tests become more consistent, less repetitive, and easier to extend, while keeping behavior the same.
It also makes path handling more explicit and type-safe in the tests by treating filesystem paths as
Pathobjects and only converting tostrwhere config values require it.