bpo-40275: Remove test.support.TESTFN_ENCODING (GH-20482)

Replace test.support.TESTFN_ENCODING with sys.getfilesystemencoding().
This commit is contained in:
Hai Shi 2020-05-28 22:24:39 +08:00 committed by GitHub
parent 84ee7e1573
commit 24bddc1b3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 14 deletions

View file

@ -19,6 +19,7 @@ from io import BytesIO, StringIO
import codecs
import os.path
import shutil
import sys
from urllib.error import URLError
import urllib.request
from test import support
@ -35,7 +36,7 @@ except UnicodeEncodeError:
supports_nonascii_filenames = True
if not os.path.supports_unicode_filenames:
try:
support.TESTFN_UNICODE.encode(support.TESTFN_ENCODING)
support.TESTFN_UNICODE.encode(sys.getfilesystemencoding())
except (UnicodeError, TypeError):
# Either the file system encoding is None, or the file name
# cannot be encoded in the file system encoding.