Skip to content

Tidy up the duplicated Tidal test fixtures - #5459

Merged
marcelveldt merged 1 commit into
devfrom
optimistic-kepler-90e13d
Aug 7, 2026
Merged

Tidy up the duplicated Tidal test fixtures#5459
marcelveldt merged 1 commit into
devfrom
optimistic-kepler-90e13d

Conversation

@marcelveldt

Copy link
Copy Markdown
Member

What does this implement/fix?

Follow-up to #5452, which left alone the fixtures that "merely share a name but differ in body". The Tidal tests were the worst case: ten test files each defined their own provider_mock, all variations on the same thing, and some missing bits the others had.

That became a trap once #5452 hoisted media_manager into the directory's conftest.py, because that fixture depends on provider_mock and the conftest doesn't define one. It resolves from whichever module asks for it, so adding a media_manager test to test_playlist.py would silently get a mock with no get_item_mapping and fail on an unreadable <Mock name='mock.get_item_mapping().item_id'> comparison instead of a clear error.

The ten copies now merge into one shared provider_mock in the directory's conftest.py, so media_manager is self-contained and every module starts from the same fully-wired provider.

  • one provider_mock in tests/providers/tidal/conftest.py, merged from the ten module copies
  • test_streaming.py keeps a small same-name override for the parts only it needs (streaming quality and the throttler bypass)
  • the note on media_manager explaining the cross-module resolution is no longer needed

Related issue (if applicable):

  • n/a

Types of changes

  • Bugfix (non-breaking change which fixes an issue) — bugfix
  • New feature (non-breaking change which adds functionality) — new-feature
  • Enhancement to an existing feature — enhancement
  • New music/player/metadata/plugin provider — new-provider
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) — breaking-change
  • Refactor (no behaviour change) — refactor
  • Documentation only — documentation
  • Maintenance / chore — maintenance
  • CI / workflow change — ci
  • Dependencies bump — dependencies

Checklist

  • The code change is tested and works locally.
  • pre-commit run --all-files passes.
  • pytest passes, and tests have been added/updated under tests/ where applicable.
  • For changes to shared models, the companion PR in music-assistant/models is linked.
  • For changes affecting the UI, the companion PR in music-assistant/frontend is linked.
  • I have read and complied with the project's AI Policy for any AI-assisted contributions.
  • I have raised a PR against the documentation repository targeting the main or beta branch as appropriate.

Copilot AI lite review requested due to automatic review settings August 7, 2026 17:26

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

This PR continues the provider-test fixture consolidation work by unifying the previously duplicated Tidal provider_mock fixtures into a single shared implementation in tests/providers/tidal/conftest.py, so all Tidal provider tests start from the same fully wired mock provider.

Changes:

  • Centralizes the common Tidal provider_mock (auth/session, api, mass collaborators, get_item_mapping, pagination helpers) into tests/providers/tidal/conftest.py.
  • Removes per-test-module provider_mock duplicates across the Tidal test suite.
  • Keeps a streaming-specific customization in test_streaming.py (quality + throttler bypass), intended to be layered on top of the shared mock.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/providers/tidal/conftest.py Introduces a shared, fully wired provider_mock and keeps shared throttling patches.
tests/providers/tidal/test_streaming.py Replaces the local provider mock with a streaming-specific customization of the shared mock.
tests/providers/tidal/test_recommendations.py Drops module-local provider_mock in favor of the shared fixture.
tests/providers/tidal/test_playlist.py Drops module-local provider_mock in favor of the shared fixture.
tests/providers/tidal/test_parsers.py Drops module-local provider_mock in favor of the shared fixture.
tests/providers/tidal/test_page_parser.py Drops module-local provider_mock in favor of the shared fixture.
tests/providers/tidal/test_page_parser_extended.py Drops module-local provider_mock in favor of the shared fixture.
tests/providers/tidal/test_media.py Drops module-local provider_mock in favor of the shared fixture.
tests/providers/tidal/test_media_extended.py Drops module-local provider_mock in favor of the shared fixture.
tests/providers/tidal/test_library.py Drops module-local provider_mock in favor of the shared fixture.
tests/providers/tidal/test_api_client.py Drops module-local provider_mock in favor of the shared fixture.

Comment thread tests/providers/tidal/conftest.py
Comment thread tests/providers/tidal/test_streaming.py
Copilot AI review requested due to automatic review settings August 7, 2026 17:32
@marcelveldt
marcelveldt force-pushed the optimistic-kepler-90e13d branch from 571b1db to 608cfd6 Compare August 7, 2026 17:32

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

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

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

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

@marcelveldt
marcelveldt marked this pull request as ready for review August 7, 2026 19:22
@marcelveldt
marcelveldt merged commit c693aee into dev Aug 7, 2026
18 checks passed
@marcelveldt
marcelveldt deleted the optimistic-kepler-90e13d branch August 7, 2026 19:25
marcelveldt added a commit that referenced this pull request Aug 7, 2026
# What does this implement/fix?

A Tidal test checked that the ISRC lookup is sent to the Tidal open API,
but it compared the URL against a value the test fixture had made up
itself rather than the URL the provider actually uses. The check passed
only because the two strings happened to be identical, so it would not
have noticed if the lookup stopped targeting the open API.

The test now compares against the provider's real `OPEN_API_URL`
constant.

- Import `OPEN_API_URL` from the Tidal provider constants in
`tests/providers/tidal/test_streaming.py` and assert against it
- Drop the unused `provider_mock.api.OPEN_API_URL` line from the fixture
(production code never reads that attribute)

Verified by removing `base_url` from the lookup call in the provider:
the test now fails, where before it passed.

Follow-up to #5459, which left this alone to keep that PR
behaviour-neutral.

## Types of changes

- [ ] Bugfix (non-breaking change which fixes an issue) — `bugfix`
- [ ] New feature (non-breaking change which adds functionality) —
`new-feature`
- [ ] Enhancement to an existing feature — `enhancement`
- [ ] New music/player/metadata/plugin provider — `new-provider`
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected) — `breaking-change`
- [ ] Refactor (no behaviour change) — `refactor`
- [ ] Documentation only — `documentation`
- [x] Maintenance / chore — `maintenance`
- [ ] CI / workflow change — `ci`
- [ ] Dependencies bump — `dependencies`

## Checklist

- [x] The code change is tested and works locally.
- [x] `pre-commit run --all-files` passes.
- [x] `pytest` passes, and tests have been added/updated under `tests/`
where applicable.
- [x] For changes to shared models, the companion PR in
`music-assistant/models` is linked.
- [x] For changes affecting the UI, the companion PR in
`music-assistant/frontend` is linked.
- [x] I have read and complied with the project's [AI
Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md)
for any AI-assisted contributions.
- [x] I have [raised a PR against the documentation
repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md)
targeting the main or beta branch as appropriate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants