Remove handling of mbcs encoding

This has been phased out in Python 3.6.

https://peps.python.org/pep-0529/
This commit is contained in:
Šarūnas Nejus 2025-04-20 10:24:57 +01:00
parent 4fcb148d60
commit 5826d6b59b
No known key found for this signature in database
GPG key ID: DD28F6704DBE3435
2 changed files with 2 additions and 21 deletions

View file

@ -19,7 +19,6 @@ import os.path
import re
import shutil
import stat
import sys
import time
import unicodedata
import unittest
@ -423,19 +422,6 @@ class DestinationTest(BeetsTestCase):
dest = self.i.destination(relative_to_libdir=True)
assert as_string(dest) == unicodedata.normalize("NFC", instr)
def test_non_mbcs_characters_on_windows(self):
oldfunc = sys.getfilesystemencoding
sys.getfilesystemencoding = lambda: "mbcs"
try:
self.i.title = "h\u0259d"
self.lib.path_formats = [("default", "$title")]
p = self.i.destination()
assert b"?" not in p
# We use UTF-8 to encode Windows paths now.
assert "h\u0259d".encode() in p
finally:
sys.getfilesystemencoding = oldfunc
def test_unicode_extension_in_fragment(self):
self.lib.path_formats = [("default", "foo")]
self.i.path = util.bytestring_path("bar.caf\xe9")

View file

@ -156,13 +156,8 @@ class PathConversionTest(BeetsTestCase):
assert path == outpath
def _windows_bytestring_path(self, path):
old_gfse = sys.getfilesystemencoding
sys.getfilesystemencoding = lambda: "mbcs"
try:
with _common.platform_windows():
return util.bytestring_path(path)
finally:
sys.getfilesystemencoding = old_gfse
with _common.platform_windows():
return util.bytestring_path(path)
def test_bytestring_path_windows_encodes_utf8(self):
path = "caf\xe9"