beets/test
Sam Thursfield 2fa3717731 Optimise FormattedMapping when querying a specific set of fields
This changes greatly improves the speed of `beet export` and `beet info`
when the `--include-keys` option is used. It also removes the globbing
feature of `--include-keys` that was added in #1295. (See #3762 for
discussion).

Listing all fields for an item requires querying the database to find
any flex attributes. This is slow when done for every item being
exported. We already have a way for the user to specify a fixed set
of keys, but we previously queried everything and filtered it afterwards.
The new approach is more efficient.

Code that iterates through all fields now have to handle invalid field
names. The export and info plugins output invalid fields as None.

Timings before:

    > /usr/bin/time beet export -i title,path,artist -l  Bob Dylan
    13.26user 20.22system 0:34.01elapsed 98%CPU (0avgtext+0avgdata 52544maxresident)k

    > /usr/bin/time beet export -l  Bob Dylan
    12.93user 20.15system 0:33.58elapsed 98%CPU (0avgtext+0avgdata 53632maxresident)k

Timings after:

    > /usr/bin/time beet export -l  Bob Dylan
    13.33user 20.17system 0:34.02elapsed 98%CPU (0avgtext+0avgdata 53500maxresident)k

    > /usr/bin/time beet export -i title,path,artist -l  Bob Dylan
    0.49user 0.07system 0:00.56elapsed 98%CPU (0avgtext+0avgdata 50496maxresident)k

Notice the dramatic speedup in the last example!
2021-05-01 23:41:09 +02:00
..
rsrc Clean up code and tests for Genius Lyrics plugin backend (#3641) 2020-07-06 08:41:27 -05:00
__init__.py add missing division future imports 2016-04-16 18:33:54 +02:00
_common.py Add HAVE_REFLINK flag for tests 2020-07-22 18:00:25 +02:00
helper.py tests: avoid non-test classes named Test* 2019-06-02 16:35:37 +10:00
lyrics_download_samples.py s/utf8/utf-8/ in all encoding/decoding contexts 2016-09-06 23:10:24 -04:00
test_acousticbrainz.py Issue #2860 Fetch more acousticbrainz fields 2019-07-23 20:25:26 -04:00
test_art.py fetchart/artresizer: add max_filesize support (#3560) 2021-03-23 12:00:14 +01:00
test_art_resize.py fetchart/artresizer: add max_filesize support (#3560) 2021-03-23 12:00:14 +01:00
test_autotag.py cleaning up, renaming dup_XXInfo() to copy() 2020-05-08 16:32:12 +02:00
test_bareasc.py Remove unnecessary call to format. 2021-03-16 22:36:42 +00:00
test_beatport.py Add BPSyncPlugin 2019-10-03 18:04:12 -07:00
test_bucket.py Undo from _common import unittest indirection 2016-11-26 18:46:44 -05:00
test_config_command.py Replace more instances of unsafe calls to yaml.load 2019-04-20 01:14:15 +02:00
test_convert.py Delete after convert (#3700) 2020-08-03 20:20:20 -05:00
test_datequery.py Set up date tests for #2652 2018-02-20 22:57:58 -05:00
test_dbcore.py Merge remote-tracking branch 'upstream/master' into pr/item-album-fallback 2020-07-27 19:32:44 +02:00
test_discogs.py fixing per review comments 2019-07-01 21:04:35 +02:00
test_edit.py Merge pull request #2668 from wordofglass/edit_logic 2017-08-25 15:52:40 +02:00
test_embedart.py mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
test_embyupdate.py Undo from _common import unittest indirection 2016-11-26 18:46:44 -05:00
test_export.py export: Add --format=jsonlines option 2020-10-02 12:41:29 +02:00
test_fetchart.py test_fetchart: Fix for hidden files on Windows 2018-12-21 11:27:09 +01:00
test_filefilter.py mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
test_files.py Merge pull request #3088 from rubdos/reflink 2020-11-27 13:29:10 -05:00
test_ftintitle.py Undo from _common import unittest indirection 2016-11-26 18:46:44 -05:00
test_hidden.py Undo from _common import unittest indirection 2016-11-26 18:46:44 -05:00
test_hook.py Add tests for hook errors 2019-10-17 11:08:18 +01:00
test_ihate.py Undo from _common import unittest indirection 2016-11-26 18:46:44 -05:00
test_importadded.py Add option to hardlink when importing 2017-02-19 15:56:13 -06:00
test_importer.py Support extra tags for MusicBrainz queries 2020-03-20 14:13:40 -04:00
test_importfeeds.py Undo from _common import unittest indirection 2016-11-26 18:46:44 -05:00
test_info.py Optimise FormattedMapping when querying a specific set of fields 2021-05-01 23:41:09 +02:00
test_ipfs.py Add fallback for item access to album's attributes 2019-06-05 02:38:46 +02:00
test_keyfinder.py keyfinder: Catch output from keyfinder-cli with no key 2020-12-07 22:04:05 -05:00
test_lastgenre.py improve tests prefer_specific without canonical 2018-07-01 09:19:36 +02:00
test_library.py Add fallback for item access to album's attributes 2019-06-05 02:38:46 +02:00
test_logging.py Replace blind excepts with generic Exception excepts in tests 2017-04-29 00:12:14 +02:00
test_lyrics.py Merge branch 'master' into tekstowo-lyrics 2021-03-28 12:05:42 -06:00
test_mb.py Add trackdisambig from musicbrainz. 2021-02-27 15:07:32 -06:00
test_mbsubmit.py Undo from _common import unittest indirection 2016-11-26 18:46:44 -05:00
test_mbsync.py mbsync no longer queries MusicBrainz when the either the mb_albumid or mb_trackid field is invalid 2018-09-09 15:20:26 +10:00
test_metasync.py Undo from _common import unittest indirection 2016-11-26 18:46:44 -05:00
test_mpdstats.py mpdstats: Don't record a skip when stopping MPD. 2020-08-10 07:07:17 -07:00
test_parentwork.py style 2020-12-22 16:02:48 +01:00
test_permissions.py Undo from _common import unittest indirection 2016-11-26 18:46:44 -05:00
test_pipeline.py tests: avoid non-test classes named Test* 2019-06-02 16:35:37 +10:00
test_play.py rename --force to --yes in play plugin 2017-04-19 10:51:44 -07:00
test_player.py Fix new flake8 warnings 2020-05-13 08:20:50 -04:00
test_playlist.py Fix new flake8 warnings 2020-05-13 08:20:50 -04:00
test_plexupdate.py Rename use_secure to secure and add to changelog 2020-06-08 20:19:19 -04:00
test_plugin_mediafield.py mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
test_plugins.py mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
test_query.py Merge remote-tracking branch 'upstream/master' into pr/item-album-fallback 2020-07-27 19:32:44 +02:00
test_random.py Make test_random work with setup.py test 2019-05-30 12:59:16 +10:00
test_replaygain.py Removes support for bs1770gain. 2021-01-27 17:42:18 -08:00
test_smartplaylist.py Undo from _common import unittest indirection 2016-11-26 18:46:44 -05:00
test_sort.py Undo from _common import unittest indirection 2016-11-26 18:46:44 -05:00
test_spotify.py Appease Flake8 2019-01-22 10:53:18 -08:00
test_subsonicupdate.py reformating subsonicupdate.py 2021-01-12 18:31:43 +01:00
test_template.py Fix #2562: avoid crash with newlines in templates 2017-05-16 14:00:10 -04:00
test_the.py fix regex, add test and changelog entry 2020-07-30 22:42:31 +02:00
test_thumbnails.py Fix thumbnail plugin pathlib bug (#3360) 2020-07-15 21:00:50 -05:00
test_types_plugin.py confit: replace with confuse in tests 2019-06-01 10:13:13 +10:00
test_ui.py don't assume items are queried in any specific order in interactive delete test 2020-09-13 15:55:09 +02:00
test_ui_commands.py Undo from _common import unittest indirection 2016-11-26 18:46:44 -05:00
test_ui_importer.py tests: avoid non-test classes named Test* 2019-06-02 16:35:37 +10:00
test_ui_init.py Allow exiting object selection early 2018-11-28 17:17:12 +00:00
test_util.py Undo from _common import unittest indirection 2016-11-26 18:46:44 -05:00
test_vfs.py Undo from _common import unittest indirection 2016-11-26 18:46:44 -05:00
test_web.py Fixed bug where readonly value was not being read from config file. 2021-03-12 17:58:35 +00:00
test_zero.py mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
testall.py Setup path correctly in testall.py 2019-05-31 11:28:55 +10:00