From 5826d6b59bd7cc082254080085a61c8ea44b0458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Nejus?= Date: Sun, 20 Apr 2025 10:24:57 +0100 Subject: [PATCH] Remove handling of mbcs encoding This has been phased out in Python 3.6. https://peps.python.org/pep-0529/ --- test/test_library.py | 14 -------------- test/test_util.py | 9 ++------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/test/test_library.py b/test/test_library.py index d90b9efd7..8e5e01f5c 100644 --- a/test/test_library.py +++ b/test/test_library.py @@ -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") diff --git a/test/test_util.py b/test/test_util.py index b82ebed10..28a3a4ce1 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -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"