Commit graph

272 commits

Author SHA1 Message Date
Šarūnas Nejus
33bed79a13
Move scrub test to a separate file 2025-05-17 03:32:00 +01:00
Šarūnas Nejus
0980c82959
musicbrainz: update patches 2025-05-17 03:31:59 +01:00
Šarūnas Nejus
4fc9f0c3d6
Centralize AutotagStub test setup into AutotagImportTestCase 2025-05-17 03:31:58 +01:00
valrus
99d2da66dc use actual value of matcher, not typo'd one 2025-02-03 19:32:27 -08:00
valrus
f520790713 s/macthin/matching/ 2025-02-03 19:32:27 -08:00
Adam Harder
d6ac687de1 fix #4840 and add to test case 2024-11-06 23:14:47 -05:00
Šarūnas Nejus
f36bc497c8
Fix lint issues
- Fix imports
- Fix pytest issues
- Do not assign lambda as variable
- Use isinstance instead of type to check type
- Rename ambiguously named variables
- Name custom errors with Error suffix
2024-09-21 11:59:18 +01:00
Šarūnas Nejus
4f3b0faba5
Handle missing reflink dependency in tests 2024-09-04 19:06:55 +01:00
ThinkChaos
65f2285dd3
fix(import): don't throw away album flexible fields
As noted by 5bf4e3d92f, MusicBrainz
external IDs (`*_album_id`) were only saved for items and not albums.
This commit addresses that by copying `AlbumInfo` fields to the `Album`,
i.e. what's saved in the DB.
This is similar to how `TrackInfo` fields are copied to `Item` instances
except the copying is done at a different time since we only get an
`Album` much later in the import flow.
2024-08-26 13:06:28 -04:00
Šarūnas Nejus
847e3858a6
Replace assertRaises 2024-08-12 08:43:42 +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
2616bcc950
Replace assertIsNotNone 2024-08-12 08:43:41 +01:00
Šarūnas Nejus
5d4911e905
Replace assertIsNone 2024-08-12 08:43:41 +01:00
Šarūnas Nejus
cb82917fe0
Replace assertFalse 2024-08-12 08:43:41 +01:00
Šarūnas Nejus
0ecc345143
Replace assertTrue 2024-08-05 17:11:16 +01:00
Šarūnas Nejus
5f395ab4f4
Configure plugins using PluginMixin.configure_plugin 2024-07-29 15:33:12 +01:00
Šarūnas Nejus
6dda984862
Standardize ImportPretendTest import files prep 2024-07-28 18:58:54 +01:00
Šarūnas Nejus
139b54ebd1
Add setup_singleton_importer for singleton importer 2024-07-28 18:58:53 +01:00
Šarūnas Nejus
8d85cfd72a
Define AsIsImporterMixin to run autotag=False importer 2024-07-28 18:58:53 +01:00
Šarūnas Nejus
f042f5ad32
Leave a single source of truth for importer setup 2024-07-28 18:58:53 +01:00
Šarūnas Nejus
7e444db914
Rename _create_import_dir -> prepare_album_for_import 2024-07-28 18:58:53 +01:00
Šarūnas Nejus
c2fdf9873d
Synchronise ImportHelper._create_import_dir and TestHelper.create_importer implementations 2024-07-28 18:58:53 +01:00
Šarūnas Nejus
1f8466f04a
Move create_importer to ImportHelper 2024-07-28 18:58:53 +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
16cf8dd937
Centralize db setup on disk 2024-07-28 18:58:34 +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
0b5b94460a
Replace unittest.TestCase, ImportHelper by ImportTestCase 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
Šarūnas Nejus
3e278159ed
Dedupe TestHelper and _common.TestCase setup 2024-07-28 18:58:33 +01:00
Šarūnas Nejus
2566e22744
Incorporate _common.Assertions into helper.TestHelper 2024-07-28 18:58:05 +01:00
Šarūnas Nejus
3177bc44ba
test_importer.py: do not run _common.TestCase.setUp with setup_beets 2024-07-12 20:32:18 +01:00
Šarūnas Nejus
f388ff6ec1
Replace py3_path with builtin os.fsdecode
`os.fsdecode` has only been available since Python 3.2.
2024-06-16 00:52:37 +01:00
Leo Nikkilä
7bcca193d5 Fix reflink: "auto" option
The docs say:

> The `auto` option uses reflinks when possible and falls back to plain
> copying when necessary.

I've been using this option for a while, and recently discovered that
despite the option, copying fails between two BTRFS filesystems with:

    Error: OS/filesystem does not support reflinks. during link of paths /mnt/fs1/file, /mnt/fs2/file

I tracked this down to how the configuration is handled in the importer.
2024-06-08 01:26:24 +03:00
freddiewanah
e0de6e1b89 refactor the test methods to avoid suboptimal asserts. 2024-04-08 21:39:25 +08: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
Lars Kruse
7707e23456 tests: move reusable components from test.test_importer to test.helper
`ImportHelper` and `AutotagStub` are used in many tests.
Thus, they should reside in a module which is obviously used by multiple
tests.
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
Adrian Sampson
c15ccb16bf
Merge pull request #4900 from fracai/4326-scrub-no-rewrite
4326 scrub should not restore on import if "write" is disabled
2023-09-16 12:47:07 -04:00
Arno Hautala
5c34db565c must unload_plugins() during teardown after load_plugins() during setup 2023-09-12 20:09:59 -04:00
Arno Hautala
e91a56d180 fix tests 2023-09-11 12:03:25 -04:00
Arno Hautala
8defbe4093 scrub on import tests 2023-09-10 19:03:13 -04:00
Jesse Bannon
f72261e44f
Add support for artists and albumartists multi-valued tags (#4743)
Adds the following fields with id3v2.4 multi-valued tag support to autotag:
    - artists, artists_sort, artists_credit
    - albumartists, albumartists_sort, albumartists_credit
    - mb_artistids, mb_albumartistids

MusicBrainz support to populate + write the above multi-valued tags by default. Can be toggled to use id3v2.3 or id3v2.4 tags via the existing beets configuration option `id3v23`.

Big thanks to @JOJ0, @OxygenCobalt, @arsaboo for testing + @sampsyo for the initial code review .
2023-09-09 09:46:26 +02:00
wisp3rwind
9af9eb9b31 tests: make use of our custom filesystem assertions for conciseness
this replaces assertions of the form
    self.assertTrue(os.path.exists(syspath(path)))
by
    self.assertExists(path)
which includes the syspath conversion and is much easier to read.

Occurences where located using
    git grep -E 'assert(True|False).*(isdir|isfile|exist)'
2023-07-16 10:42:47 +02:00
Adrian Sampson
16a30f4d74
Merge pull request #4714 from TypicalFence/gh-654
resolve transl-tracklisting relations for pseudo releases
2023-06-26 14:40:28 -07:00
wisp3rwind
1ef6b90786 add missing syspath conversions (1/3, tests)
these are mostly in the tests, which didn't cause issues since the
affected directories usually have nice ASCII paths. For consistency, it
is nicer to always invoke syspath. That also avoids deprecation warnings
for the bytestring interfaces on Python <= 3.5. The bytestring
interfaces were undeprecated with PEP 529 in Python 3.6, such that we
didn't observe any actual failures.
2023-06-24 14:52:46 +02:00
fence
dccc62443d fix tests 2023-06-19 20:13:16 +02:00
wisp3rwind
5de1d12610 tests: address some warnings
- some helper functions were incorrectly detected as being tests due to
  their name
- use of the deprecated assertEquals alias
2023-05-07 18:43:43 +02:00
J0J0 Todos
efc88193f9 Add test_reimported_album_not_preserves_flexattr
Checks if a reimported album flexible attribute "data_source" will be updated
correctly from the match being applied.
2023-04-11 07:11:20 +02:00