コード例 #1
0
ファイル: test_childutils.py プロジェクト: Davidwang79/minos
 def test_stdout(self):
     from supervisor.childutils import pcomm
     old = sys.stdout
     try:
         io = sys.stdout = StringIO()
         pcomm.stdout('hello')
         from supervisor.events import ProcessCommunicationEvent
         begin = ProcessCommunicationEvent.BEGIN_TOKEN
         end = ProcessCommunicationEvent.END_TOKEN
         self.assertEqual(io.getvalue(), '%s%s%s' % (begin, 'hello', end))
     finally:
         sys.stdout = old
コード例 #2
0
 def test_stdout(self):
     from supervisor.childutils import pcomm
     old = sys.stdout
     try:
         io = sys.stdout = StringIO()
         pcomm.stdout('hello')
         from supervisor.events import ProcessCommunicationEvent
         begin = ProcessCommunicationEvent.BEGIN_TOKEN
         end = ProcessCommunicationEvent.END_TOKEN
         self.assertEqual(io.getvalue(), '%s%s%s' % (begin, 'hello', end))
     finally:
         sys.stdout = old