summaryrefslogtreecommitdiff
path: root/wintest
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-11-30 11:55:48 +1100
committerAndrew Tridgell <tridge@samba.org>2010-12-01 11:03:25 +1100
commit7526171ce596daf008798bd2ab63bb57c08b184a (patch)
tree6dbdb2c7a04c22d98cd4a4ead801580477304865 /wintest
parent1079195a7652e890d6e683f4f29d0454d72141e6 (diff)
downloadsamba-7526171ce596daf008798bd2ab63bb57c08b184a.tar.gz
samba-7526171ce596daf008798bd2ab63bb57c08b184a.tar.bz2
samba-7526171ce596daf008798bd2ab63bb57c08b184a.zip
wintest: make expect calls case insensitive by default
Diffstat (limited to 'wintest')
-rw-r--r--wintest/wintest.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/wintest/wintest.py b/wintest/wintest.py
index c98083f57d..cc24c0d22a 100644
--- a/wintest/wintest.py
+++ b/wintest/wintest.py
@@ -216,23 +216,26 @@ class wintest():
self.info("retrying (retries=%u delay=%u)" % (retries, delay))
raise RuntimeError("Failed to find %s" % contains)
- def pexpect_spawn(self, cmd, timeout=60, crlf=True):
+ def pexpect_spawn(self, cmd, timeout=60, crlf=True, casefold=True):
'''wrapper around pexpect spawn'''
cmd = self.substitute(cmd)
self.info("$ " + cmd)
ret = pexpect.spawn(cmd, logfile=sys.stdout, timeout=timeout)
def sendline_sub(line):
- line = self.substitute(line).replace('\n', '\r\n')
- return ret.old_sendline(line + '\r')
+ line = self.substitute(line)
+ if crlf:
+ line = line.replace('\n', '\r\n') + '\r'
+ return ret.old_sendline(line)
- def expect_sub(line, timeout=ret.timeout):
+ def expect_sub(line, timeout=ret.timeout, casefold=casefold):
line = self.substitute(line)
+ if casefold:
+ line = "(?i)" + line
return ret.old_expect(line, timeout=timeout)
- if crlf:
- ret.old_sendline = ret.sendline
- ret.sendline = sendline_sub
+ ret.old_sendline = ret.sendline
+ ret.sendline = sendline_sub
ret.old_expect = ret.expect
ret.expect = expect_sub