Skip to content

playlist: refactor tests#6819

Open
snejus wants to merge 8 commits into
masterfrom
refactor-test-playlist
Open

playlist: refactor tests#6819
snejus wants to merge 8 commits into
masterfrom
refactor-test-playlist

Conversation

@snejus

@snejus snejus commented Jul 5, 2026

Copy link
Copy Markdown
Member

Part of #6807.

  • Refactors test/plugins/test_playlist.py to use pathlib.Path as the main path abstraction instead of building paths manually with os.path.join.

  • Centralizes playlist test setup by introducing shared helpers like write_absolute_playlist(), write_relative_playlist(), and reusable path attributes such as c_track_path and nonexisting_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 playlist configuration 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 Path objects and only converting to str where config values require it.

Copilot AI review requested due to automatic review settings July 5, 2026 13:19
@snejus snejus requested a review from a team as a code owner July 5, 2026 13:19
@github-actions github-actions Bot added the playlist playlist plugin label Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

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

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.83%. Comparing base (8ddae79) to head (7a8c529).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
beets/util/extension.py 70.00% 1 Missing and 2 partials ⚠️
beets/importer/tasks.py 89.47% 1 Missing and 1 partial ⚠️
beets/util/__init__.py 87.50% 1 Missing and 1 partial ⚠️
beets/util/hidden.py 83.33% 0 Missing and 1 partial ⚠️
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     
Files with missing lines Coverage Δ
beetsplug/fetchart.py 74.18% <100.00%> (ø)
beets/util/hidden.py 54.16% <83.33%> (+6.54%) ⬆️
beets/importer/tasks.py 90.87% <89.47%> (-0.29%) ⬇️
beets/util/__init__.py 80.35% <87.50%> (-0.33%) ⬇️
beets/util/extension.py 76.47% <70.00%> (-4.18%) ⬇️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Path objects 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

Comment thread test/plugins/test_playlist.py
Comment thread test/plugins/test_playlist.py
Comment thread test/plugins/test_playlist.py
Comment thread test/plugins/test_playlist.py Outdated
Comment thread test/plugins/test_playlist.py Outdated
Comment thread test/plugins/test_playlist.py Outdated
Comment thread test/plugins/test_playlist.py Outdated
@snejus snejus force-pushed the refactor-test-playlist branch 2 times, most recently from 265fa0e to 85a30f6 Compare July 5, 2026 13:42
@snejus snejus force-pushed the tests/remove-redundant-logic branch 2 times, most recently from 414fe59 to 230bf19 Compare July 7, 2026 14:57
Base automatically changed from tests/remove-redundant-logic to master July 7, 2026 16:51
@snejus snejus force-pushed the refactor-test-playlist branch from 85a30f6 to 7a8c529 Compare July 7, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

playlist playlist plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants