test: improve coverage from 66% to 84%#35
Merged
jakebromberg merged 4 commits intomainfrom Mar 10, 2026
Merged
Conversation
added 4 commits
March 10, 2026 00:00
Cover matching.is_compilation_artist, artist_splitting edge cases (_split_trailing_and single-component, _try_ampersand_split, numeric comma guard), csv_to_tsv.main(), fix_csv_newlines.fix_csv_dir/main(), filter_csv edge cases and main(), verify_cache.format_bytes/print_report, and export_to_sqlite.format_size/_do_export table/FTS verification.
…enrich_library_artists, and import_csv Cover wait_for_postgres, run_sql_file, run_sql_statements_parallel error paths, report_sizes, convert_and_filter command construction, enrich_library_artists command construction, _load_or_create_state resume modes, main() input validation, parse_args validation, MySQL extraction functions (extract_alternate_names, extract_cross_referenced_artists, extract_release_cross_ref_artists), enrich main() with and without MySQL, and import_csv main() dispatch to _import_tables vs _import_tables_parallel.
…cache coverage gaps Add integration tests exercising previously uncovered code paths against a real PostgreSQL database: dedup_releases.py (63% -> 73%): TestEnsureDedupIdsAlreadyExists verifies the early-return path when dedup_delete_ids table already exists. TestAddTrackConstraintsAndIndexes verifies FK constraints and GIN trigram indexes on track tables. TestAddConstraintsAndIndexes verifies the wrapper function creates both base and track constraints. import_csv.py (86% -> 97%): TestPopulateCacheMetadata verifies COPY-based bulk insert of cache_metadata rows. TestImportArtwork verifies primary/fallback image selection, invalid release_id skipping, and empty URI handling. TestImportArtworkMissing and TestCreateTrackCountTableMissing verify the missing-file warning paths. TestImportTables verifies sequential import of table configs including missing CSV handling. verify_cache.py (83% -> 86%): TestGetTableSizes verifies asyncpg-based row count and size queries across all release tables. TestCountRowsToDelete verifies row counting for single, multiple, empty, and nonexistent release ID sets. TestPruneReleases verifies CASCADE deletion of releases and child rows.
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.
Closes #34
Summary
format_bytes,format_size,is_compilation_artist) andmain()functions (csv_to_tsv,fix_csv_newlines,filter_csv)wait_for_postgres,run_sql_file,report_sizes, CLI validation, MySQL query extraction)dedup_releases,import_csv, andverify_cachecoverage gapsNo production code changes. All 593 tests pass (9 skipped MySQL tests).
Test plan
pytest tests/unit/ -v-- 411 unit tests passDATABASE_URL_TEST=... pytest -m 'not mysql' -v-- 593 tests pass, 9 skipped