mirror of
https://github.com/beetbox/beets.git
synced 2026-01-01 13:33:02 +01:00
better tolerance in RG tests
The first fix avoids contaminating all future tests if the plugin fails to load. The second skips the CLI backend tests when the appropriate tool is not available (just as we do with the GStreamer tests).
This commit is contained in:
parent
ed8002bed5
commit
5477a5d039
1 changed files with 23 additions and 1 deletions
|
|
@ -16,6 +16,7 @@
|
|||
import os
|
||||
import shutil
|
||||
from glob import glob
|
||||
import subprocess
|
||||
|
||||
import _common
|
||||
from _common import unittest
|
||||
|
|
@ -36,7 +37,14 @@ class ReplayGainCliTestBase(TestHelper):
|
|||
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
self.load_plugins('replaygain')
|
||||
|
||||
try:
|
||||
self.load_plugins('replaygain')
|
||||
except:
|
||||
self.teardown_beets()
|
||||
self.unload_plugins()
|
||||
raise
|
||||
|
||||
self.config['replaygain']['backend'] = self.backend
|
||||
self.config['plugins'] = ['replaygain']
|
||||
self.setupLibrary(2)
|
||||
|
|
@ -126,6 +134,20 @@ class ReplayGainGstCliTest(ReplayGainCliTestBase, unittest.TestCase):
|
|||
class ReplayGainCmdCliTest(ReplayGainCliTestBase, unittest.TestCase):
|
||||
backend = u'command'
|
||||
|
||||
def setUp(self):
|
||||
# Check for the backend command.
|
||||
for command in ['mp3gain', 'aacgain']:
|
||||
try:
|
||||
subprocess.check_call([command, '-v'])
|
||||
except OSError:
|
||||
pass
|
||||
else:
|
||||
break
|
||||
else:
|
||||
self.skipTest('no *gain command found')
|
||||
|
||||
super(ReplayGainCmdCliTest, self).setUp()
|
||||
|
||||
|
||||
def suite():
|
||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||
|
|
|
|||
Loading…
Reference in a new issue