mirror of
https://github.com/beetbox/beets.git
synced 2026-01-26 18:15:01 +01:00
test_replaygain: fix complicated and incorrect exception handling
This is an incorrect translation of a python 2 reraise to python 3. With python 3, however, we can just rely on exception chaining to get the traceback, so get rid of the complicated re-raising entirely, with the additional benefit that the exception from the tear-down is also shown.
This commit is contained in:
parent
c3a0bb1d81
commit
d26b0bc19b
1 changed files with 2 additions and 12 deletions
|
|
@ -55,18 +55,8 @@ class ReplayGainCliTestBase(TestHelper):
|
||||||
try:
|
try:
|
||||||
self.load_plugins('replaygain')
|
self.load_plugins('replaygain')
|
||||||
except Exception:
|
except Exception:
|
||||||
import sys
|
self.teardown_beets()
|
||||||
# store exception info so an error in teardown does not swallow it
|
self.unload_plugins()
|
||||||
exc_info = sys.exc_info()
|
|
||||||
try:
|
|
||||||
self.teardown_beets()
|
|
||||||
self.unload_plugins()
|
|
||||||
except Exception:
|
|
||||||
# if load_plugins() failed then setup is incomplete and
|
|
||||||
# teardown operations may fail. In particular # {Item,Album}
|
|
||||||
# may not have the _original_types attribute in unload_plugins
|
|
||||||
pass
|
|
||||||
raise None.with_traceback(exc_info[2])
|
|
||||||
|
|
||||||
album = self.add_album_fixture(2)
|
album = self.add_album_fixture(2)
|
||||||
for item in album.items():
|
for item in album.items():
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue