[Twisted-Python] Re: [Twisted-commits] r11107 - Delete fundamentally broken test.

James Y Knight foom at fuhm.net
Fri Jul 23 09:38:56 EDT 2004


Wait, wait, that causes *hangs*? That seems like a bad thing. It 
doesn't look like an obviously wrong thing to do to me. Do you know 
*why* it's hanging?

James

On Jul 23, 2004, at 2:06 AM, Andrew Bennetts wrote:
> warner and I agree that this test wasn't testing any useful behaviours 
> that
> anything could actually depend upon, and it causes far too many 
> intermittent
> test failures (and even hangs!)

> -class PausingProcessProtocol(protocol.ProcessProtocol):
> -
> -    data = ""
> -    elapsed = None
> -
> -    def connectionMade(self):
> -        self.transport.pauseProducing()
> -        self.transport.write("a")
> -        reactor.callLater(2, self.transport.resumeProducing)
> -
> -    def outReceived(self, d):
> -        self.data += d
> -
> -    def processEnded(self, reason):
> -        self.data = self.data.lstrip("a")
> -        if len(self.data) != 5:
> -            self.elapsed = ValueError  # XXX!
> -        else:
> -            self.elapsed = float(self.data)
> -
[...]
> -
> -    def testPausing(self):
> -        exe = sys.executable
> -        scriptPath = util.sibpath(__file__, "process_pausing.py")
> -        p = PausingProcessProtocol()
> -        reactor.spawnProcess(p, exe, [exe, "-u", scriptPath], 
> env=None)
> -        while p.elapsed == None:
> -            reactor.iterate(0.01)
> -        self.failIfEqual(p.elapsed, ValueError, 'Child process wrote 
> garbage')
> -        self.assert_(2.1 > p.elapsed > 1.5) # assert how long process 
> was paused





More information about the Twisted-Python mailing list