mirror of
https://github.com/beetbox/beets.git
synced 2025-12-14 20:43:41 +01:00
replaygain: Use on-disk database
there can only be a single connection to an in-memory database, but the parallel replaygain code accesses the db from different threads
This commit is contained in:
parent
48222153ae
commit
30baf22e77
1 changed files with 2 additions and 22 deletions
|
|
@ -22,14 +22,11 @@ import six
|
|||
from mock import patch
|
||||
from test.helper import TestHelper, capture_log, has_program
|
||||
|
||||
from sqlite3 import OperationalError
|
||||
|
||||
from beets import config
|
||||
from beets.util import CommandOutput
|
||||
from mediafile import MediaFile
|
||||
from beetsplug.replaygain import (FatalGstreamerPluginReplayGainError,
|
||||
GStreamerBackend,
|
||||
ReplayGainPlugin)
|
||||
GStreamerBackend)
|
||||
|
||||
|
||||
try:
|
||||
|
|
@ -63,26 +60,9 @@ def reset_replaygain(item):
|
|||
item.store()
|
||||
|
||||
|
||||
def _store_retry_once(self, item):
|
||||
"""Helper method to retry item.store() once in case
|
||||
of a sqlite3.OperationalError exception.
|
||||
|
||||
:param self: `ReplayGainPlugin` instance
|
||||
:param item: a library item to store
|
||||
"""
|
||||
try:
|
||||
item.store()
|
||||
except OperationalError:
|
||||
# test_replaygain.py :memory: library can fail with
|
||||
# `sqlite3.OperationalError: no such table: items`
|
||||
# but the second attempt succeeds
|
||||
item.store()
|
||||
|
||||
|
||||
@patch.object(ReplayGainPlugin, '_store', _store_retry_once)
|
||||
class ReplayGainCliTestBase(TestHelper):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
self.setup_beets(disk=True)
|
||||
self.config['replaygain']['backend'] = self.backend
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue