Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR deduplicates shared tests setup that was used across test files. It attempts to centralise the setup into a single source of truth implementation in `beets.test.helper`. This works towards the eventual migration to `pytest` (#5361) making it easier to replace the tests setup with `pytest` fixtures. It builds upon the temporary files cleanup in #5345. ## Details ### Test setup * Mostly duplicate test setup implementations in `beets.test._common.TestCase` and `beets.test.helper.TestHelper` were merged into a single implementation as `beets.test.helper.BeetsTestCase`. * Replaced `unittest.TestCase` and `beets.test.helper.TestHelper` combination with `beets.test.helper.ImportTestCase` * Refactored `test/test_plugins.py` removing duplicate import files setup. * Centralised setting up the database on disk. * Centralised plugin test setup into `beets.test.helpers.PluginMixin`. ### Removals * Around 1/3 of the removed lines correspond to the removal of `def suite()` functions that were previously used for tests collection. * Removed redundant `setUp` and `tearDown` methods from many test files given that the functions that they performed had been centralised in `beets.test.helper`. * Removed redundant library initialisations ### Importing * Centralised import directory creation (only gets created on the first access). * Deduplicated `_setup_import_session` implementations in `TerminalImportSessionSetup` and `ImportHelper`. * Merged `ImportHelper._create_import_dir` and `TestHelper.create_importer` implementations into `ImportHelper.setup_importer`. * Merged various takes on import files prep into `ImportHelper.prepare_albums_for_import` and `ImportHelper.prepare_album_for_import`. * Seeing that many tests used it, defined `AsIsImporterMixin` which provides a method `run_asis_importer` to setup _asis_ (non-autotag) importer and run it
- Loading branch information