def test_display(self): with captured_output() as (out, err): trace_mockup.TraceMockup([u'fake_progname', u'-display', u'-mxver', u'7']) errout = err.getvalue() if not errout is None and len(errout) > 0: print_str(errout, f=sys.stderr) output = out.getvalue() print_str(u'#### output:') print_str(output) l = len(output) self.assertLess(10, l, u'Had expected more than len==10 for output') self.assertTrue(self.find_keyword(output, u"\n Version:"))
def test_print_indv_SIPLP(self): with captured_output() as (out, err): trace_mockup.TraceMockup([u'fake_progname', u'-print', u'1', u'-mxver', u'7']) errout = err.getvalue() if not errout is None and len(errout) > 0: print_str(errout, f=sys.stderr) self.fail(u"Something on stderr") output = out.getvalue() print_str(u'#### output:') print_str(output) self.assertTrue(self.find_keyword(output, u" Version:")) self.assertEqual(u"1", self.find_keyword(output, u"\n Trace ind:")) self.assertEqual(u"SIPLP", self.find_keyword(output, u" Unit name:"))
def test_print_id(self): with captured_output() as (out, err): trace_mockup.TraceMockup([u'fake_progname', u'-print', u'3', u'-mxver', u'7']) errout = err.getvalue() if not errout is None and len(errout) > 0: print_str(errout, f=sys.stderr) output = out.getvalue() print_str(u'#### output:') print_str(output) self.assertLess(10, len(output), u'Had expected more than len==10 for output') self.assertTrue(self.find_keyword(output, u" Version:")) self.assertEqual(u"3", self.find_keyword(output, u"\n Trace ind:")) self.assertEqual(u"CMP", self.find_keyword(output, u" Unit name:")) end_of_header = output.find(u"\n\n") or output.find(u"\r\n\r\n") pos_siplp = output.find(u"SIPLP") if pos_siplp > 0: self.assertLess(end_of_header, pos_siplp, u"Should not be any SIPLP keyword in output")
def main_mx7x(): return trace_mockup.TraceMockup(sys.argv + [u'-mxver', u'7'])
def main_mx6x(): return trace_mockup.TraceMockup(6)