def test_stderr(self): from supervisor.childutils import pcomm old = sys.stderr try: io = sys.stderr = StringIO() pcomm.stderr('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.stderr = old