diff --git a/mopidy/config/types.py b/mopidy/config/types.py index a2f759df..ec0be1de 100644 --- a/mopidy/config/types.py +++ b/mopidy/config/types.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals import logging import re import socket -import sys from mopidy.utils import path from mopidy.config import validators @@ -257,7 +256,7 @@ class Path(ConfigValue): def serialize(self, value, display=False): if isinstance(value, unicode): - value = value.encode(sys.getfilesystemencoding()) + raise ValueError('paths should always be bytes') if isinstance(value, ExpandedPath): return value.original return value diff --git a/tests/config/types_test.py b/tests/config/types_test.py index 24f1265e..88c8f067 100644 --- a/tests/config/types_test.py +++ b/tests/config/types_test.py @@ -5,7 +5,6 @@ from __future__ import unicode_literals import logging import mock import socket -import sys import unittest from mopidy.config import types @@ -367,7 +366,4 @@ class PathTest(unittest.TestCase): def test_serialize_unicode_string(self): value = types.Path() - expected = 'æøå'.encode(sys.getfilesystemencoding()) - result = value.serialize('æøå') - self.assertEqual(expected, result) - self.assertIsInstance(result, bytes) + self.assertRaises(ValueError, value.serialize, 'æøå')