mirror of
https://github.com/beetbox/beets.git
synced 2026-11-30 09:24:34 -06:00
## Description Fixes #7002. Both `py7zr` and `rarfile` are optional dependencies specified under the `import` extra (`beets[import]`). When running the test suite in environments where `py7zr` is not installed (e.g. minimal packaging buildroots such as Fedora Rawhide), `ArchiveImportTask.handlers` does not register the 7z extraction handler. Consequently, `TestImport7z` runs unconditionally and treats `archive.7z` as an ordinary file rather than an archive, failing with: ```text FAILED test/test_importer.py::TestImport7z::test_import_zip E assert 0 == 1 E + where 0 = len(<beets.dbcore.db.Results object>) E + where <beets.dbcore.db.Results object> = items() WARNING beets:stages.py:58 No files imported from .../test/rsrc/archive.7z ``` Additionally, `TestImportRar` previously checked only for the presence of the `unrar` executable via `has_program("unrar")`, but extraction also depends on the Python `rarfile` package being importable. This PR: 1. Adds `NEEDS_PY7ZR` (`is_importable("py7zr")`) and `NEEDS_RARFILE` (`is_importable("rarfile") and has_program("unrar")`) test skip markers in `beets.test.helper`. 2. Marks `TestImport7z` with `@NEEDS_PY7ZR`. 3. Marks `TestImportRar` with `@NEEDS_RARFILE`. 4. Adds an unreleased bug fix entry to `docs/changelog.rst`. ## To Do - [x] ~Documentation.~ - [x] Changelog. - [x] Tests.