From 5112985cc7db6bd07d8e2ca41903443a93174974 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Thu, 29 Mar 2018 16:59:14 +0200 Subject: [PATCH 1/3] m3u: Fix tests on macOS 10.13 --- tests/m3u/test_playlists.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/m3u/test_playlists.py b/tests/m3u/test_playlists.py index e0ea1ce4..e993f9b1 100644 --- a/tests/m3u/test_playlists.py +++ b/tests/m3u/test_playlists.py @@ -151,6 +151,9 @@ class M3UPlaylistsProviderTest(unittest.TestCase): self.assertEqual(playlist.name, result.name) self.assertEqual(track.uri, result.tracks[0].uri) + @unittest.skipIf( + platform.system() == 'Darwin', + 'macOS 10.13 raises IOError "Illegal byte sequence" on open.') def test_load_playlist_with_nonfilesystem_encoding_of_filename(self): path = os.path.join(self.playlists_dir, 'øæå.m3u'.encode('latin-1')) with open(path, 'wb+') as f: @@ -160,10 +163,7 @@ class M3UPlaylistsProviderTest(unittest.TestCase): self.assertEqual(len(self.core.playlists.as_list()), 1) result = self.core.playlists.as_list() - if platform.system() == 'Darwin': - self.assertEqual('%F8%E6%E5', result[0].name) - else: - self.assertEqual('\ufffd\ufffd\ufffd', result[0].name) + self.assertEqual('\ufffd\ufffd\ufffd', result[0].name) @unittest.SkipTest def test_playlists_dir_is_created(self): From 2e32b5c8bf09effc364049242935dc9dae3fd59e Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Thu, 29 Mar 2018 17:06:08 +0200 Subject: [PATCH 2/3] audio: Explicitly convert long to int --- mopidy/audio/scan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mopidy/audio/scan.py b/mopidy/audio/scan.py index 72c4bee6..f4efdb69 100644 --- a/mopidy/audio/scan.py +++ b/mopidy/audio/scan.py @@ -176,7 +176,7 @@ def _query_duration(pipeline): elif duration < 0: duration = None # Stream without duration. else: - duration = duration // Gst.MSECOND + duration = int(duration // Gst.MSECOND) return success, duration From c59eccb06c9f7fd87756534cdfea3d74b8f85648 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Thu, 29 Mar 2018 17:11:35 +0200 Subject: [PATCH 3/3] stream: Don't compare entire track object On Ubuntu 16.04 with GStreamer 1.2, we don't get a bitrate. On Ubuntu 18.04 or macOS with GStreamer 1.12, we get a bitrate. --- tests/stream/test_library.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/stream/test_library.py b/tests/stream/test_library.py index 29348a6c..312feb69 100644 --- a/tests/stream/test_library.py +++ b/tests/stream/test_library.py @@ -60,4 +60,8 @@ def test_lookup_converts_uri_metadata_to_track(audio, config, track_uri): backend = actor.StreamBackend(audio=audio, config=config) result = backend.library.lookup(track_uri) - assert result == [Track(length=4406, uri=track_uri)] + + assert len(result) == 1 + track = result[0] + assert track.uri == track_uri + assert track.length == 4406