Initial import to Tizen
[profile/ivi/python-twisted.git] / twisted / test / stdio_test_writeseq.py
1 # -*- test-case-name: twisted.test.test_stdio.StandardInputOutputTestCase.test_writeSequence -*-
2 # Copyright (c) Twisted Matrix Laboratories.
3 # See LICENSE for details.
4
5 """
6 Main program for the child process run by
7 L{twisted.test.test_stdio.StandardInputOutputTestCase.test_writeSequence} to test that
8 ITransport.writeSequence() works for process transports.
9 """
10
11 import sys, _preamble
12
13 from twisted.internet import stdio, protocol
14 from twisted.python import reflect
15
16 class WriteSequenceChild(protocol.Protocol):
17     def connectionMade(self):
18         self.transport.writeSequence(list('ok!'))
19         self.transport.loseConnection()
20
21
22     def connectionLost(self, reason):
23         reactor.stop()
24
25
26 if __name__ == '__main__':
27     reflect.namedAny(sys.argv[1]).install()
28     from twisted.internet import reactor
29     stdio.StandardIO(WriteSequenceChild())
30     reactor.run()