~terceiro/lava-dispatcher/filter-ansi-color-codes-mwhudson-state-machine

« back to all changes in this revision

Viewing changes to lava_dispatcher/tests/test_utils.py

  • Committer: Antonio Terceiro
  • Date: 2013-08-08 22:23:31 UTC
  • Revision ID: antonio.terceiro@linaro.org-20130808222331-l2xqo15bzmooivbb
An solution based on Michael Hudson's state machine

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
import os
24
24
 
25
 
from lava_dispatcher.utils import logging_spawn, remove_ansi_escape_codes
 
25
from lava_dispatcher.utils import logging_spawn
26
26
 
27
27
class TestLoggingSpawn(TestCase):
28
28
 
55
55
        self.assertIsNot(proc.match, pexpect.EOF)
56
56
 
57
57
    def test_filter_out_incomplete_sequences_followed_by_others(self):
58
 
        data = "\x1b[01;01\x1b[=3hHELLO"
59
 
        self.assertEqual(remove_ansi_escape_codes(data), "HELLO")
 
58
        proc = logging_spawn('print "HELLO\x1b[01;01\x1b[=3h THERE"')
 
59
        proc.expect(['HELLO THERE'])
 
60
        self.assertIsNot(proc.match, pexpect.EOF)
60
61
 
61
62