示例#1
0
    def test_05_output(self):
        """
        test ouput of pending messages
        """
        Messager.warning(u'Hello warning')
        Messager.info(u'Hello info')
        Messager.debug(u'Hello debug')

        Messager.error(u'Hello error')
        output = NamedTemporaryFile("w", delete=False)
        try:
            Messager.output(output)

            output.close()
            with open(output.name, "r") as output:
                self.assertEqual(
                    output.read(), u"warning : Hello warning\n"
                    u"comment : Hello info\n"
                    u'debug : Hello debug\n'
                    u'error : Hello error\n')
            Messager.clear()

            with open(output.name, "w") as output:
                Messager.output(output)
            with open(output.name, "r") as output:
                self.assertEqual(output.read(), "")
        finally:
            os.unlink(output.name)
示例#2
0
 def setUpClass(cls):
     # this test suite assumes Messager heap is empty
     Messager.clear()