mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Temporary commit of fix to issue #5380 (in order to watch buildbot response)
This commit is contained in:
parent
cdd98fb463
commit
16e026cc94
3 changed files with 99 additions and 21 deletions
|
@ -280,11 +280,29 @@ class PosixTester(unittest.TestCase):
|
|||
if hasattr(posix, 'strerror'):
|
||||
self.assertTrue(posix.strerror(0))
|
||||
|
||||
def check_pipe_func(self, pipe_func):
|
||||
master_fd, slave_fd = pipe_func()
|
||||
try:
|
||||
# Simulate a subprocess writing some data to the
|
||||
# slave end of the pipe, and then exiting.
|
||||
data = b'TEST DATA'
|
||||
try:
|
||||
os.write(slave_fd, data)
|
||||
finally:
|
||||
os.close(slave_fd)
|
||||
# Request more data than available
|
||||
gotdata = os.read(master_fd, len(data) + 1)
|
||||
self.assertEqual(gotdata, data)
|
||||
finally:
|
||||
os.close(master_fd)
|
||||
|
||||
def test_pipe(self):
|
||||
if hasattr(posix, 'pipe'):
|
||||
reader, writer = posix.pipe()
|
||||
os.close(reader)
|
||||
os.close(writer)
|
||||
self.check_pipe_func(posix.pipe)
|
||||
|
||||
def test_openpty(self):
|
||||
if hasattr(posix, 'openpty'):
|
||||
self.check_pipe_func(posix.openpty)
|
||||
|
||||
def test_tempnam(self):
|
||||
if hasattr(posix, 'tempnam'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue