~ntt-pf-lab/nova/monkey_patch_notification

« back to all changes in this revision

Viewing changes to vendor/Twisted-10.0.0/twisted/test/stdio_test_writeseq.py

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- test-case-name: twisted.test.test_stdio.StandardInputOutputTestCase.test_writeSequence -*-
 
2
# Copyright (c) 2006-2007 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
 
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()