mirror of
https://github.com/beetbox/beets.git
synced 2025-12-31 13:02:47 +01:00
Thumbnails: add None check on lib_name
`find_library` could return None, which would not cause an OSError from `loadLibrary`, making the plugin (falsely) think the library is available Also fixed wrong method call to skip test in that case See #1277
This commit is contained in:
parent
e953e6bdcb
commit
c95b89ebc1
2 changed files with 3 additions and 1 deletions
|
|
@ -241,6 +241,8 @@ class GioURI(URIGetter):
|
|||
def get_library(self):
|
||||
lib_name = ctypes.util.find_library("gio-2")
|
||||
try:
|
||||
if not lib_name:
|
||||
return False
|
||||
return ctypes.cdll.LoadLibrary(lib_name)
|
||||
except OSError:
|
||||
return False
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ class ThumbnailsTest(unittest.TestCase, TestHelper):
|
|||
gio = GioURI()
|
||||
plib = PathlibURI()
|
||||
if not gio.available:
|
||||
self.skip("GIO library not found")
|
||||
self.skipTest("GIO library not found")
|
||||
|
||||
self.assertEqual(gio.uri("/foo"), b"file:///") # silent fail
|
||||
self.assertEqual(gio.uri(b"/foo"), b"file:///foo")
|
||||
|
|
|
|||
Loading…
Reference in a new issue