/
/
# What does this implement/fix? A test that checks a library merge emits no item events was failing at random in full test runs, but never on its own. The cause was the test server itself: after it boots, it keeps doing work that lands in whatever test happens to be running. Two things leak out of a boot: - Each music provider's **first library sync** is armed 10 seconds after the provider loads. On a busy machine a test is often still running by then, so a real sync (plus a database cleanup and a genre scan) fires in the middle of it. - A provider **finishes loading in the background**, after the server reports itself started. Measured on every boot: one provider was still starting its server ~1.2s into the test. Registering a background task along the way also sends out a task list update a fraction of a second later. Test fixtures now boot a server that stays quiet, so a test only ever sees the events it causes itself. The merge test's original strict assertion is restored. Waiting for the boot to finish costs about 13% on a full test run (226s to 255s, measured back to back), in exchange for tests no longer racing the server they are testing. **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` - [x] Maintenance / chore — `maintenance` - [ ] CI / workflow change — `ci` - [ ] Dependencies bump — `dependencies` ### Changes - Test fixtures hold music providers to their recurring sync only, so no sync starts on its own during a test. - Test fixtures wait for every provider to finish loading, and for the boot's in-flight events to land, before handing the server to a test. - Both also applied to the integration test fixture, which boots the same way. - Restored `signal_event.assert_not_called()` in the merge test, replacing the filter added in #5792. - The 10 second first-sync delay is now a named constant. ## 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. - [ ] 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. - [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. - [ ] 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.