diff options
author | noah <noah@656d521f-e311-0410-88e0-e7920216d269> | 2006-02-02 10:47:25 +0000 |
---|---|---|
committer | noah <noah@656d521f-e311-0410-88e0-e7920216d269> | 2006-02-02 10:47:25 +0000 |
commit | c38408fa39f5281d2dfda9e0b56f1bedc05a12ea (patch) | |
tree | b02891c8e6cb6648be0ca7a1e2a09cb74124e057 /pexpect/tests | |
parent | eaf382afa72a420eee860e813a1289663e07deab (diff) | |
download | pexpect-c38408fa39f5281d2dfda9e0b56f1bedc05a12ea.tar.gz |
Added delayafterclose and delayafterterminate so that it is easy
to fine tune kernel timing delays in close() and terminate().
See SourceForge request 1384090.
git-svn-id: http://pexpect.svn.sourceforge.net/svnroot/pexpect/trunk@345 656d521f-e311-0410-88e0-e7920216d269
Diffstat (limited to 'pexpect/tests')
-rwxr-xr-x | pexpect/tests/test_expect.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pexpect/tests/test_expect.py b/pexpect/tests/test_expect.py index de1ff14..49b7822 100755 --- a/pexpect/tests/test_expect.py +++ b/pexpect/tests/test_expect.py @@ -11,6 +11,16 @@ import PexpectTestCase # This may not be true, but seems adequate for testing now. # I should fix this at some point. +FILTER=''.join([(len(repr(chr(x)))==3) and chr(x) or '.' for x in range(256)]) +def hex_dump(src, length=8): + result=[] + for i in xrange(0, len(src), length): + s = src[i:i+length] + hexa = ' '.join(["%02X"%ord(x) for x in s]) + printable = s.translate(FILTER) + result.append("%04X %-*s %s\n" % (i, length*3, hexa, printable)) + return ''.join(result) + class ExpectTestCase (PexpectTestCase.PexpectTestCase): def test_expect_basic (self): @@ -117,7 +127,7 @@ class ExpectTestCase (PexpectTestCase.PexpectTestCase): break the_new_way = the_new_way[:-1] the_new_way = the_new_way.replace('\r','\n') - assert the_old_way == the_new_way + assert the_old_way == the_new_way, hex_dump(the_new_way) + "\n" + hex_dump(the_old_way) # def test_expect_exact (self): # the_old_way = commands.getoutput('ls -l /bin') |