Introduce Source class to encapsulate metadata extraction logic,
replacing scattered `get_most_common_tags` calls throughout codebase.
- Add Source class in importer.tasks with artist, name, and metadata
- Simplify `distance()` to accept Source.data instead of items list
- Update display functions to use Source objects
- Cache Source creation with @cached_property on ImportTask
This centralizes metadata handling and reduces coupling between
autotag and library modules.
- Removing the coverage omit configuration exposed unused branches, helpers, and
fixtures across the test suite.
- Delete that redundant logic and simplify affected tests while preserving their
behavior.
TIL that `with_suffix` does not simply append the suffix to the filename
- it instead replaces the old/current suffix. Or whatever seems to
look like a suffix, in our case, unfortunately...
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.
- move tests for case_sensitive to test_util.py, since this is not
really the concern of PathQueryTest
- removes part of the tests, since the tests that patch os.path.samefile
and os.path.exists are super brittle since they test the
implementation rather than the functionality of case_sensitive().
This is a prepartory step for actually changing the implementation,
which would otherwise break the tests in a confusing way...
On Windows, converting command-line arguments (hopefully!!!) only needs
to deal with valid strings from the OS. So it is not really relevant to
test with non-UTF-8, non-surrogate bytes.
This was a vestige from when we used to need the unittest2 library for pre-2.7
compatibility. Now that we require Python 2.7, we aren't using that library
and this indirection wasn't doing any good.
interactive_open should now be invoked with at least the list of
targets and optionally the command to open the targets with.
This allows beets-play to pass multiple file paths directly to
the configured command.
The changes to the existing invocations are pretty trivial in
order to comply to this refactor.