distro implementation simply uses the open function without specifying the encoding explicitly. As a result, this causes tests that use unicode-specific samples to fail on systems where default encoding is different:
File "(...)/test_distro.py", line 1653, in test_os_release_attr
self._test_attr('os_release_info', 'os_release_attr')
File "(...)/test_distro.py", line 1645, in _test_attr
info = getattr(_distro, info_method)()
File "(...)/distro/__init__.py", line 853, in os_release_info
return self._os_release_info
File "(...)/distro/__init__.py", line 553, in __get__
ret = obj.__dict__[self._fname] = self._f(obj)
File "(...)/distro/__init__.py", line 930, in _os_release_info
return self._parse_os_release_content(release_file)
File "(...)/distro/__init__.py", line 961, in _parse_os_release_content
tokens = list(lexer)
File "<embedded stdlib>/shlex.py", line 295, in __next__
token = self.get_token()
File "<embedded stdlib>/shlex.py", line 105, in get_token
raw = self.read_token()
File "<embedded stdlib>/shlex.py", line 136, in read_token
nextchar = self.instream.read(1)
File "<embedded stdlib>/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 29: ordinal not in range(128)
This issue occurs only in Python 3 (Python 3.6.7 to be precise), in Python 2 this seems not to be a problem.
I am not sure what the best course of action here is. It obviously makes sense to let the operating system decide what encoding is used for storing release information. It is also important to test fringe, unicode input. But it would be also nice to be able to run tests on systems with non-standard encoding.
distroimplementation simply uses theopenfunction without specifying the encoding explicitly. As a result, this causes tests that use unicode-specific samples to fail on systems where default encoding is different:This issue occurs only in Python 3 (Python 3.6.7 to be precise), in Python 2 this seems not to be a problem.
I am not sure what the best course of action here is. It obviously makes sense to let the operating system decide what encoding is used for storing release information. It is also important to test fringe, unicode input. But it would be also nice to be able to run tests on systems with non-standard encoding.