mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-133982: Use implementation-specific open
in test_fileio.OtherFileTests
(GH-135364)
Some checks are pending
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Undefined behavior sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
Some checks are pending
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Undefined behavior sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
This commit is contained in:
parent
7e33558455
commit
23caccf74c
1 changed files with 7 additions and 5 deletions
|
@ -591,7 +591,7 @@ class OtherFileTests:
|
||||||
try:
|
try:
|
||||||
f.write(b"abc")
|
f.write(b"abc")
|
||||||
f.close()
|
f.close()
|
||||||
with open(TESTFN_ASCII, "rb") as f:
|
with self.open(TESTFN_ASCII, "rb") as f:
|
||||||
self.assertEqual(f.read(), b"abc")
|
self.assertEqual(f.read(), b"abc")
|
||||||
finally:
|
finally:
|
||||||
os.unlink(TESTFN_ASCII)
|
os.unlink(TESTFN_ASCII)
|
||||||
|
@ -608,7 +608,7 @@ class OtherFileTests:
|
||||||
try:
|
try:
|
||||||
f.write(b"abc")
|
f.write(b"abc")
|
||||||
f.close()
|
f.close()
|
||||||
with open(TESTFN_UNICODE, "rb") as f:
|
with self.open(TESTFN_UNICODE, "rb") as f:
|
||||||
self.assertEqual(f.read(), b"abc")
|
self.assertEqual(f.read(), b"abc")
|
||||||
finally:
|
finally:
|
||||||
os.unlink(TESTFN_UNICODE)
|
os.unlink(TESTFN_UNICODE)
|
||||||
|
@ -692,13 +692,13 @@ class OtherFileTests:
|
||||||
|
|
||||||
def testAppend(self):
|
def testAppend(self):
|
||||||
try:
|
try:
|
||||||
f = open(TESTFN, 'wb')
|
f = self.FileIO(TESTFN, 'wb')
|
||||||
f.write(b'spam')
|
f.write(b'spam')
|
||||||
f.close()
|
f.close()
|
||||||
f = open(TESTFN, 'ab')
|
f = self.FileIO(TESTFN, 'ab')
|
||||||
f.write(b'eggs')
|
f.write(b'eggs')
|
||||||
f.close()
|
f.close()
|
||||||
f = open(TESTFN, 'rb')
|
f = self.FileIO(TESTFN, 'rb')
|
||||||
d = f.read()
|
d = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
self.assertEqual(d, b'spameggs')
|
self.assertEqual(d, b'spameggs')
|
||||||
|
@ -734,6 +734,7 @@ class OtherFileTests:
|
||||||
class COtherFileTests(OtherFileTests, unittest.TestCase):
|
class COtherFileTests(OtherFileTests, unittest.TestCase):
|
||||||
FileIO = _io.FileIO
|
FileIO = _io.FileIO
|
||||||
modulename = '_io'
|
modulename = '_io'
|
||||||
|
open = _io.open
|
||||||
|
|
||||||
@cpython_only
|
@cpython_only
|
||||||
def testInvalidFd_overflow(self):
|
def testInvalidFd_overflow(self):
|
||||||
|
@ -755,6 +756,7 @@ class COtherFileTests(OtherFileTests, unittest.TestCase):
|
||||||
class PyOtherFileTests(OtherFileTests, unittest.TestCase):
|
class PyOtherFileTests(OtherFileTests, unittest.TestCase):
|
||||||
FileIO = _pyio.FileIO
|
FileIO = _pyio.FileIO
|
||||||
modulename = '_pyio'
|
modulename = '_pyio'
|
||||||
|
open = _pyio.open
|
||||||
|
|
||||||
def test_open_code(self):
|
def test_open_code(self):
|
||||||
# Check that the default behaviour of open_code matches
|
# Check that the default behaviour of open_code matches
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue