test: fix flaky live-API tests, restore pytest-retry - #975
Merged
Conversation
--retries was accidentally zeroed out in #939 and never restored, removing the safety net for flaky live-account tests like the upload/parallel-xdist timeout seen on main. Also drops the now-redundant manual retry loop in test_upload_song_and_verify in favor of pytest-retry re-running the test. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
YTM sometimes pads filtered results (e.g. featured_playlists) with an unrelated shelf (e.g. "Songs"). The parser forced every shelf's items to the requested filter's type regardless of the shelf's actual category, corrupting resultType/itemCount/author for those items. Skip shelves whose category doesn't match the requested filter.
Episode search results can surface episodes that YTM has since removed/delisted, causing a 404 on the get_episode follow-up call. Skip those instead of failing the whole test.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #975 +/- ##
==========================================
- Coverage 95.78% 95.77% -0.02%
==========================================
Files 47 47
Lines 2707 2723 +16
==========================================
+ Hits 2593 2608 +15
- Misses 114 115 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
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.
Summary
--retrieswas accidentally set to0in default search: fix itemSection parsing #939 (unrelated PR, no discussion) and never restored — this removed the safety net for flaky live-account tests, e.g. the upload test failure on main caused by the newly added-n 2xdist parallelism increasing load on the shared test account: https://github.com/sigma67/ytmusicapi/actions/runs/30170681258/job/89711551512--retries 2(its original value from drop 3.8, add pytest-retry #592)test_upload_song_and_verifynow that pytest-retry re-runs the whole test on failurefeatured_playlists), YTM sometimes pads results with an unrelated shelf (e.g. a"Songs"category).search()forced every shelf's items to the requested filter's type regardless of the shelf's actual category, corruptingresultType/itemCount/authorfor those items. Now shelves whose category doesn't match the requested filter are skipped instead of mislabeled.test_many_episodesnow tolerates 404s fromget_episode(): episode search can surface episodes YTM has since removed/delisted, and that's not a bug worth failing the test over.Test plan