Ejemplo n.º 1
0
    def setUp(self):
        self.session = session.Session()
        self.result = result.PluggableTestResult(self.session)
        self.plugin = buffer.OutputBufferPlugin(session=self.session)
        self.plugin.register()

        class Test(TestCase):
            def test_out(self):
                six.print_("hello")
                raise {}["oops"]

            def test_err(self):
                six.print_("goodbye", file=sys.stderr)

        self.case = Test

        class Watcher(events.Plugin):
            def __init__(self):
                self.events = []

            def testOutcome(self, event):
                self.events.append(event)

        self.watcher = Watcher(session=self.session)
        self.watcher.register()
Ejemplo n.º 2
0
    def setUp(self):
        self.session = session.Session()
        self.result = result.PluggableTestResult(self.session)
        self.plugin = buffer.OutputBufferPlugin(session=self.session)
        self.plugin.register()

        class Test(TestCase):

            printed_nonascii_str = util.safe_decode("test 日本").encode("utf-8")
            printed_unicode = six.u("hello")

            def test_out(self):
                six.print_("hello")
                raise {}["oops"]

            def test_err(self):
                six.print_("goodbye", file=sys.stderr)

            def test_mixed_unicode_and_nonascii_str(self):
                six.print_(self.printed_nonascii_str)
                six.print_(self.printed_unicode)
                six.print_(self.printed_nonascii_str, file=sys.stderr)
                six.print_(self.printed_unicode, file=sys.stderr)
                raise {}["oops"]

        self.case = Test

        class Watcher(events.Plugin):
            def __init__(self):
                self.events = []

            def testOutcome(self, event):
                self.events.append(event)

        self.watcher = Watcher(session=self.session)
        self.watcher.register()