mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-40275: Use new test.support helper submodules in tests (GH-21314)
This commit is contained in:
parent
9ce8132e1f
commit
883bc63833
19 changed files with 225 additions and 194 deletions
|
@ -1,5 +1,6 @@
|
|||
import unittest
|
||||
from test import support
|
||||
from test.support import os_helper
|
||||
|
||||
import io # C implementation.
|
||||
import _pyio as pyio # Python implementation.
|
||||
|
@ -17,18 +18,18 @@ class BufferSizeTest:
|
|||
# .readline()s deliver what we wrote.
|
||||
|
||||
# Ensure we can open TESTFN for writing.
|
||||
support.unlink(support.TESTFN)
|
||||
os_helper.unlink(os_helper.TESTFN)
|
||||
|
||||
# Since C doesn't guarantee we can write/read arbitrary bytes in text
|
||||
# files, use binary mode.
|
||||
f = self.open(support.TESTFN, "wb")
|
||||
f = self.open(os_helper.TESTFN, "wb")
|
||||
try:
|
||||
# write once with \n and once without
|
||||
f.write(s)
|
||||
f.write(b"\n")
|
||||
f.write(s)
|
||||
f.close()
|
||||
f = open(support.TESTFN, "rb")
|
||||
f = open(os_helper.TESTFN, "rb")
|
||||
line = f.readline()
|
||||
self.assertEqual(line, s + b"\n")
|
||||
line = f.readline()
|
||||
|
@ -37,7 +38,7 @@ class BufferSizeTest:
|
|||
self.assertFalse(line) # Must be at EOF
|
||||
f.close()
|
||||
finally:
|
||||
support.unlink(support.TESTFN)
|
||||
os_helper.unlink(os_helper.TESTFN)
|
||||
|
||||
def drive_one(self, pattern):
|
||||
for length in lengths:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue