def test_longFetchDoesntTimeout(self):
        """
        The connection timeout does not take effect during fetches.
        """
        c = Clock()
        SlowMailbox.callLater = c.callLater
        SlowMailbox.fetchDeferred = defer.Deferred()
        self.server.callLater = c.callLater
        SimpleServer.theAccount.mailboxFactory = SlowMailbox
        SimpleServer.theAccount.addMailbox('mailbox-test')

        self.server.setTimeout(1)

        def login():
            return self.client.login(b'testuser', b'password-test')

        def select():
            self.server.setTimeout(1)
            return self.client.select('mailbox-test')

        def fetch():
            return self.client.fetchUID('1:*')

        def stillConnected():
            self.assertNotEqual(self.server.state, 'timeout')

        def cbAdvance(ignored):
            for i in range(4):
                c.advance(.5)

        SlowMailbox.fetchDeferred.addCallback(cbAdvance)

        d1 = self.connected.addCallback(strip(login))
        d1.addCallback(strip(select))
        d1.addCallback(strip(fetch))
        d1.addCallback(strip(stillConnected))
        d1.addCallback(self._cbStopClient)
        d1.addErrback(self._ebGeneral)
        d = defer.gatherResults([d1, self.loopback()])
        return d

        The connection timeout does not take effect during fetches.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/mail/test/test_imap.py