Commit graph

2657 commits

Author SHA1 Message Date
Karl Besser
37879d0b18 Remove redundant unit tests for ftintitle plugin
Remove redundant unit tests for the `ftintitle.cotains_feat` function
2024-10-01 15:55:38 -05:00
Karl Besser
669307c91c Update ftintitle.contains_feat unit tests
Since the `for_artist` keyword has been removed from
`ftintitle.contains_feat`, the unit tests need to be updated.
This includes the deletion of the test cases that test the
`for_artist=True` delimiters.
2024-09-30 10:28:23 -05:00
Karl-Ludwig Besser
ab86b2d1e8
Merge branch 'beetbox:master' into fix_false_positive_ftintitle 2024-09-30 10:17:19 -05:00
Andrew Rogl
04ee04150a
Reworked #4709 after latest release (#5447)
Fixes #4709 SQL use of Double Quoted Strings.
2024-09-30 10:28:15 +01:00
Karl Besser
6cb2e5926b Add unit tests for separate "feat. X" detection
The unit tests for the `ftintitle.contains_feat` function are now split
up for artist and title matching.
2024-09-26 17:22:25 -04:00
Karl Besser
6c8bd424e8 Add unit tests to test new feat. X detection regex
The previous version of the `plugins.feat_tokens` regular expression
only matched "feat. X" parts if preceded by a space. This caused missed
detections in the `ftintitle.contains_feat` function.
This commit adds unit tests for the updated regex that also matches
"feat. X" parts within parentheses and brackets
2024-09-22 18:30:28 -04:00
Šarūnas Nejus
11fa6c7b3f
Introduce integration_test marker and update testing docs 2024-09-21 13:26:05 +01:00
Šarūnas Nejus
fe4d4921c1
Replace OrderedEnum with a builtin IntEnum
The variable in `test_ordered_enum` was flagged for naming issues, and
I noticed that `OrderedEnum` is essentially `enum.IntEnum`.

I guess `OrderedEnum` exists because it was created before
`enum.IntEnum` was made available in Python 3.4. We do not need it
anymore though, so it's now gone.
2024-09-21 11:59:19 +01:00
Šarūnas Nejus
5f78d1b82b
Remove some lint exclusions and fix the issues
* Replace `noqa` comments in `assert...` method definitions with
  a configuration option to ignore these names.
* Use the `__all__` variable to specify importable items from the
  module, replacing `*` imports and `noqa` comments for unused imports.
* Address issues with poorly named variables and methods by renaming
  them appropriately.
2024-09-21 11:59:19 +01: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
85a17ee503
Reformat the codebase 2024-09-21 11:57:48 +01:00
Konstantin
796c9addfb
Fixes TypeError in the Discogs plugin (#5415)
Handles the case when discogs return `None` for format descriptions.

---------

Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2024-09-19 21:27:16 +01:00
Šarūnas Nejus
5785522170
fetchart: defer file removal config option evaluation (#5244)
Defer the evaluation of the source file removal options (`import.delete`
and `import.move`) to the point where the fetchart plugin is actually
called instead of only evaluating those configuration options on plugin
initialization.
This is to allow other plugins (such as the
[ytimport](https://github.com/mgoltzsche/beets-ytimport/blob/v1.8.1/beetsplug/ytimport/__init__.py#L194)
plugin) to invoke the import directly (within the same python process;
implicitly invoking the fetchart plugin) with temporarily overwritten
configuration options.

Addresses
https://github.com/beetbox/beets/issues/5167#issuecomment-2106465172
2024-09-16 11:44:46 +01:00
Šarūnas Nejus
54b2435c72
Update dependencies and do not install reflink on Windows for tests (#5407)
See my comment under #5406 for context

> The build on win32 is failing to install reflink because it's [only
supported until Python
3.7](https://gitlab.com/rubdos/pyreflink/-/blob/master/setup.py?ref_type=heads).
>
> I will address this in a separate PR and rebase this one accordingly
once the fix is merged.
>
> Note: this issue popped up now because I added a new requests-mock
dependency which invalidated cached dependencies.
2024-09-08 12:31:02 +01:00
J0J0 Todos
98f4a88923
ftintitle: New customization option to keep feature in artist field (#5356) 2024-09-06 13:41:15 +02:00
Tânio Scherer
0b067e9f5b Create a new template function: capitalize
Update documentation

Update changelog
2024-09-05 23:00:50 -03:00
Karl-Ludwig Besser
39acba5200
Merge branch 'master' into ftintitle_keep_artist 2024-09-05 12:32:20 +02:00
Šarūnas Nejus
851699ab76
Clarify test_unsuccessful_reflink error message 2024-09-05 04:32:13 +01:00
Šarūnas Nejus
fee959c500
Handle missing reflink dependency in the business logic 2024-09-04 20:34:00 +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
111686e563
autobpm: add tests 2024-08-19 22:44:17 +01:00
Šarūnas Nejus
4b69b493d2
Use f-string syntax 2024-08-16 17:47:23 +01:00
Šarūnas Nejus
090b62f5b0
Make this test ignore my local beets config 2024-08-12 08:49:30 +01:00
Šarūnas Nejus
d3bdd93bf6
Replace assertAlmostEqual 2024-08-12 08:49:30 +01:00
Šarūnas Nejus
fcc4d8481d
Replace assertListEqual 2024-08-12 08:43:43 +01:00
Šarūnas Nejus
fdb8c28271
Replace assertCountEqual 2024-08-12 08:43:43 +01:00
Šarūnas Nejus
46bdb84b46
Replace assertGreater and assertGreaterEqual 2024-08-12 08:43:43 +01:00
Šarūnas Nejus
6a3380bcb5
Replace assertLess and assertLessEqual 2024-08-12 08:43:43 +01:00
Šarūnas Nejus
eda0ef11d6
Replace assertIsInstance 2024-08-12 08:43:42 +01:00
Šarūnas Nejus
f9359df0d1
Replace assertNotEqual 2024-08-12 08:43:42 +01: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
6631b6aef6
Replace assertNotIn 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
199f3079f2
Use PluginMixin in tests that load plugins manually
A constant `preload_plugin` is used to disable loading the plugin in the
`setUp` initialisation, allowing the plugin to be loaded manually by the
tests.

Also added a cleanup instruction to remove listeners from configured
plugins, and removed this logic from several tests.
2024-07-28 18:58:54 +01:00
Šarūnas Nejus
9c75513686
test_ui: Fix Config/Plugin/Completion tests interdependency
"test" plugin was not properly cleaned up after loading and would
therefore stay around and picked up by other tests.
2024-07-28 18:58:54 +01:00
Šarūnas Nejus
e097f1a8c6
Rewrite FileFilterPluginTest
And rewrite the tests since they were far too confusing to follow.
2024-07-28 18:58:54 +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
92f79dbfb9
Fix ConfigTest failures locally
A couple of `ConfigTest` would previously fail locally since they
somehow depended on the local environment to work fine. This commmit
decouples them from any environment by setting up patching of the
environment variables properly.
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
8065ff0461
Split album and singleton tests in edit and filefilter 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