def test_runforever_unexpected_exit(self):
        programs = ['foo']
        any = None
        prog = self._makeOnePopulated(programs, any)
        payload=('expected:0 processname:foo groupname:bar '
                 'from_state:RUNNING pid:1')
        prog.stdin.write(
            'eventname:PROCESS_STATE_EXITED len:%s\n' % len(payload))
        prog.stdin.write(payload)
        prog.stdin.seek(0)
        prog.runforever(test=True)
        output = prog.stderr.getvalue()
        lines = output.split('\n')
        self.assertEqual(lines[0], 'unexpected exit, mailing')
        self.assertEqual(lines[1], 'Mailed:')
        self.assertEqual(lines[2], '')
        self.assertEqual(lines[3], 'To: chrism@plope.com')
        self.failUnless('Subject: [foo]: foo crashed at' in lines[4])
        self.assertEqual(lines[5], '')
        self.failUnless(
            'Process foo in group bar exited unexpectedly' in lines[6])
        import os
        mail = open(os.path.join(self.tempdir, 'email.log'), 'r').read()
        self.failUnless(
            mail in 'Process foo in group bar exited unexpectedly')
dataset/ETHPy150Open XiaoMi/minos/supervisor/superlance/tests/crashmail_test.py/CrashMailTests.test_runforever_unexpected_exit/swapped operands of `in`