mirror of
https://github.com/python/cpython.git
synced 2025-10-14 10:53:40 +00:00
#9354: Provide getsockopt() in asyncore file_wrapper(). Patch by Lukas Langa.
This commit is contained in:
parent
8182b717db
commit
cbb0ae4a42
4 changed files with 24 additions and 1 deletions
|
@ -428,6 +428,19 @@ class FileWrapperTest(unittest.TestCase):
|
|||
w.close()
|
||||
self.assertEqual(open(TESTFN, 'rb').read(), self.d + d1 + d2)
|
||||
|
||||
@unittest.skipUnless(hasattr(asyncore, 'file_dispatcher'),
|
||||
'asyncore.file_dispatcher required')
|
||||
def test_dispatcher(self):
|
||||
fd = os.open(TESTFN, os.O_RDONLY)
|
||||
data = []
|
||||
class FileDispatcher(asyncore.file_dispatcher):
|
||||
def handle_read(self):
|
||||
data.append(self.recv(29))
|
||||
s = FileDispatcher(fd)
|
||||
os.close(fd)
|
||||
asyncore.loop(timeout=0.01, use_poll=True, count=2)
|
||||
self.assertEqual(b"".join(data), self.d)
|
||||
|
||||
|
||||
class BaseTestHandler(asyncore.dispatcher):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue