Ticket #4386: 4386.3.patch

File 4386.3.patch, 3.9 KB (added by moijes12, 2 years ago)

Please find attached the patch. However, the tests for the changes made to iocpreactor were skipped so I'm not sure how they will behave. If anyone can, please tell me what I require to run the tests.

  • twisted/topfiles/4386.bugfix

     
     1twisted.internet.abstract.FileDescriptor implements twisted.internet.interfaces.IPushProducer instead of twisted.internet.interfaces.IProducer. 
     2twisted.internet.iocpreactor.abstract.FileHandle implements twisted.internet.interfaces.IPushProducer instead of twisted.internet.interfaces.IProducer. 
  • twisted/internet/abstract.py

     
    155155 
    156156    SEND_LIMIT = 128*1024 
    157157 
    158     implements(interfaces.IProducer, interfaces.IReadWriteDescriptor, 
     158    implements(interfaces.IPushProducer, interfaces.IReadWriteDescriptor, 
    159159               interfaces.IConsumer, interfaces.ITransport, interfaces.IHalfCloseableDescriptor) 
    160160 
    161161    def __init__(self, reactor=None): 
  • twisted/internet/iocpreactor/abstract.py

     
    2222    """ 
    2323    File handle that can read and write asynchronously 
    2424    """ 
    25     implements(interfaces.IProducer, interfaces.IConsumer, 
     25    implements(interfaces.IPushProducer, interfaces.IConsumer, 
    2626               interfaces.ITransport, interfaces.IHalfCloseableDescriptor) 
    2727    # read stuff 
    2828    maxReadBuffers = 16 
  • twisted/internet/test/test_iocp.py

     
    1414 
    1515from twisted.trial import unittest 
    1616from twisted.python.log import msg 
     17from twisted.internet.interfaces import IPushProducer 
    1718 
    1819try: 
    1920    from twisted.internet.iocpreactor import iocpsupport as _iocp, tcp, udp 
    2021    from twisted.internet.iocpreactor.reactor import IOCPReactor, EVENTS_PER_LOOP, KEY_NORMAL 
    2122    from twisted.internet.iocpreactor.interfaces import IReadWriteHandle 
    2223    from twisted.internet.iocpreactor.const import SO_UPDATE_ACCEPT_CONTEXT 
     24    from twisted.internet.iocpreactor.abstract import FileHandle 
    2325except ImportError: 
    2426    skip = 'This test only applies to IOCPReactor' 
    2527 
     
    117119        verifyClass(IReadWriteHandle, udp.Port) 
    118120 
    119121 
     122    def test_fileHandleInterfaces(self): 
     123        """ 
     124        Verify that L{Filehandle} implements L{IPushProducer}. 
     125        """ 
     126        verifyClass(IPushProducer, FileHandle) 
     127 
     128 
    120129    def test_maxEventsPerIteration(self): 
    121130        """ 
    122131        Verify that we don't lose an event when more than EVENTS_PER_LOOP 
  • twisted/internet/test/test_filedescriptor.py

     
    55Whitebox tests for L{twisted.internet.abstract.FileDescriptor}. 
    66""" 
    77 
     8from zope.interface.verify import verifyClass 
     9 
    810from twisted.internet.abstract import FileDescriptor 
     11from twisted.internet.interfaces import IPushProducer 
    912from twisted.trial.unittest import TestCase 
    1013 
    1114 
    1215 
    13 class FileDescriptorWriteSequenceTests(TestCase): 
     16class FileDescriptorTests(TestCase): 
    1417    """ 
    15     Tests for L{FileDescriptor.writeSequence}. 
     18    Tests for L{FileDescriptor}. 
    1619    """ 
    1720    def test_writeWithUnicodeRaisesException(self): 
    1821        """ 
     
    2932        fileDescriptor = FileDescriptor() 
    3033        self.assertRaises( 
    3134            TypeError, fileDescriptor.writeSequence, ['foo', u'bar', 'baz']) 
     35 
     36 
     37    def test_implementInterfaceIPushProducer(self): 
     38        """ 
     39        L{FileDescriptor} should implement L{IPushProducer}. 
     40        """ 
     41        self.assertTrue(verifyClass(IPushProducer, FileDescriptor))