Repository navigation
Add a proper test suite - #1553
Merged
Merged
Conversation
The client had a single request test and 35% coverage on radio_browser.py, kept above the 60% floor by the models alone. - Share fixtures in conftest.py, like python-fumis and python-elgato: an aioresponses fixture, a client fixture, load_fixture, and the aiohttp stream_writer compatibility patch. - Mock the DNS SRV lookup for every test. A failed request forgets the host, so a retry used to resolve the real API servers. - Add fixtures captured from the live API, trimmed to a few items each. - Cover every endpoint with snapshots, the error paths, retries, the host lookup, session handling and the models. - Drop the 60% floor, so covdefaults enforces 100% coverage.
SLF001 is already ignored for all tests in tests/ruff.toml.
This was referenced Oct 1, 2026
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.
Breaking change
None. Tests only.
Proposed change
The client had a single request test. Coverage on
radio_browser.pywas 35%, and the 60% floor was only met thanks to the models. This adds a real test suite and lets covdefaults enforce 100% coverage.The setup follows python-fumis and python-elgato: shared fixtures in
conftest.py(anaioresponsesfixture, a client fixture,load_fixture, and the aiohttpstream_writercompatibility patch for aioresponses).One thing specific to this library: the DNS SRV lookup for the API host is now mocked for every test. A failed request forgets the host, so without that mock a retry resolved the real Radio Browser servers. The suite now runs fine without any network access.
What is covered:
The fixtures are real API responses, trimmed to a few items each. Tests describe the current behavior. Two known quirks are visible in the snapshots on purpose (
station_countcomes out as a string, and empty comma separated fields become['']); the upcoming bugfix PR will update those snapshots.Type of change
Additional information
Checklist
poetry run pytestpasses locally. A pull request cannot be merged unless CI is green.poetry run prek run --all-filespasses (lint, format, and type checks).