'If a read from the input file fails while producing bytes to the
consumer, the L{Deferred} returned by
L{FileBodyProducer.startProducing} fires with a L{Failure} wrapping
that exception.'

def test_failedReadWhileProducing(self):

    class BrokenFile(object, ):
        def read(self, count):
            raise IOError('Simulated    bad    thing')
    producer = FileBodyProducer(BrokenFile(), self.cooperator)
    complete = producer.startProducing(FileConsumer(BytesIO()))
    self._scheduled.pop(0)()
    self.failureResultOf(complete).trap(IOError)
