summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2023-02-07 22:13:53 (GMT)
committerThomas Wouters <thomas@python.org>2023-02-07 22:13:53 (GMT)
commit0d3d5007b136ff1bc0faa960d6526e047dd92396 (patch)
tree6f8bdeea32063127e8c63728244798dac1d3f06f /Lib
parent46f461be56ab90891d2d43240d80a0e19d100ba9 (diff)
parentacc2f3b19d28d4bf3f8fb32357f581cba5ba24c7 (diff)
downloadcpython-0d3d5007b136ff1bc0faa960d6526e047dd92396.zip
cpython-0d3d5007b136ff1bc0faa960d6526e047dd92396.tar.gz
cpython-0d3d5007b136ff1bc0faa960d6526e047dd92396.tar.bz2
Merge branch 'main' of https://github.com/python/cpython into main
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_fileio.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index 2263604..ebfcffd 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -12,7 +12,9 @@ from functools import wraps
from test.support import (
cpython_only, swap_attr, gc_collect, is_emscripten, is_wasi
)
-from test.support.os_helper import (TESTFN, TESTFN_UNICODE, make_bad_fd)
+from test.support.os_helper import (
+ TESTFN, TESTFN_ASCII, TESTFN_UNICODE, make_bad_fd,
+ )
from test.support.warnings_helper import check_warnings
from collections import UserList
@@ -431,18 +433,15 @@ class OtherFileTests:
def testBytesOpen(self):
# Opening a bytes filename
- try:
- fn = TESTFN.encode("ascii")
- except UnicodeEncodeError:
- self.skipTest('could not encode %r to ascii' % TESTFN)
+ fn = TESTFN_ASCII.encode("ascii")
f = self.FileIO(fn, "w")
try:
f.write(b"abc")
f.close()
- with open(TESTFN, "rb") as f:
+ with open(TESTFN_ASCII, "rb") as f:
self.assertEqual(f.read(), b"abc")
finally:
- os.unlink(TESTFN)
+ os.unlink(TESTFN_ASCII)
@unittest.skipIf(sys.getfilesystemencoding() != 'utf-8',
"test only works for utf-8 filesystems")