15 Commits

Author SHA1 Message Date
Sebastian Mohr
cf97ce87b8 Refactored test_mb_sync to use pytest and removed capture_log in favor
of caplog.
2026-05-14 15:47:00 +02:00
ShimmerGlass
65ccaf1408 fix(mbsync): do not clear metadata if import.from_scratch is set
if import.from_scratch was set in the config, runnning mbsync would
clear any metadata not provided by MBz (replay gain, lyrics, genres...).
we now ignore this setting when running mbsync to preserve metadata.

Fixes: #6613
2026-05-13 18:06:08 +02:00
Šarūnas Nejus
35361a63b6 Require data_source in album_for_id and track_for_id functions
These functions now accept both an ID and data_source parameter,
enabling plugins like mbsync and missing to retrieve metadata from the
correct source.

Update mbsync and missing plugins to use the restored functions with
explicit data_source parameters. Add data_source validation to prevent
lookups when the source is not specified.

Add get_metadata_source helper function to retrieve plugins by their
data_source name, cached for performance.
2026-03-10 00:56:35 +00:00
Sebastian Mohr
178e27f11f Fixed imports for all tests and added a bit of stricter type checking. 2025-07-15 15:03:14 +02:00
Šarūnas Nejus
d1d681c1ff mbsync: support other data sources 2025-04-14 02:28:43 +01:00
Šarūnas Nejus
2681c83c5b Remove redundant generate_album_info and generate_track_info functions
These functions were used to generate mock data for tests but have been
replaced with direct instantiation of AlbumInfo and TrackInfo objects.
This change simplifies the test code and removes unnecessary helper
functions.
2024-10-16 06:39:30 +01:00
Šarūnas Nejus
9a05d27acf Replace assertEqual 2024-08-12 08:43:42 +01:00
Šarūnas Nejus
11e948121c Replace assertIn 2024-08-12 08:43:42 +01:00
Šarūnas Nejus
fcff5d72af Remove def suite TestLoader definitions 2024-07-28 18:58:51 +01:00
Šarūnas Nejus
432da560e4 Create PluginTestCase to dedupe plugin setup 2024-07-28 18:58:35 +01:00
Šarūnas Nejus
2d5fd907c3 Remove redundant setup_beets and teardown_beets instructions 2024-07-28 18:58:34 +01:00
Šarūnas Nejus
6c1e26acc9 Replace unittest.TestCase, TestHelper by BeetsTestCase 2024-07-28 18:58:34 +01:00
Lars Kruse
508d28f66b tests: move reusable test-related modules into the beets package
External Python packages interfacing beets may want to use an in-memory
beets library instance for testing beets-related code.
The `TestHelper` class is very helpful for this purpose.
Previously `TestHelper` was located in the `test/` directory.
Now it is part of `beets` itself (`beets.test.helper.TestHelper`) and
can be easily imported.
2024-01-15 19:40:57 +01:00
Serene-Arc
a6e5201ff3 Apply formatting tools to all files
This is 'the big one', which touches every file so that it all conforms
to the given standard.
2023-10-22 09:53:18 +10:00
Serene-Arc
84c0ab6857 Correctly refactor tests 2023-10-17 19:39:03 +10:00