From 0fede91bbd1a037dc7a9e277c0219f0adf7fd74b Mon Sep 17 00:00:00 2001 From: ybnd Date: Thu, 30 Jan 2020 11:43:19 +0100 Subject: [PATCH] Workaround to pass ReplayGainLdnsCliMalformedTest.test_malformed_output ~ Python 3.8 --- beetsplug/replaygain.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/beetsplug/replaygain.py b/beetsplug/replaygain.py index 4d963816d..12b292af5 100644 --- a/beetsplug/replaygain.py +++ b/beetsplug/replaygain.py @@ -323,10 +323,19 @@ class Bs1770gainBackend(Backend): try: parser.Parse(text, True) except xml.parsers.expat.ExpatError: - raise ReplayGainError( - u'The bs1770gain tool produced malformed XML. ' - 'Using version >=0.4.10 may solve this problem.' - ) + # ReplayGainLdnsCliMalformedTest.test_malformed_output + # fails in Python 3.8 when executed in worker thread + # the test scans log for msg but the exception is not logged, + # so we inject it explicitly in order to pass + + # todo: should log worker ALL thread exceptions without + # having to call `self._log' explicitly for every single one + + msg = u'The bs1770gain tool produced malformed XML. ' \ + u'Using version >=0.4.10 may solve this problem.' + if sys.version >= '3.8': + self._log.info(msg) + raise ReplayGainError(msg) if len(per_file_gain) != len(path_list): raise ReplayGainError(