From 63cf3e972f45c095e2a4c451eeb8875c32fce3bb Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Tue, 6 Oct 2020 16:03:06 -0700 Subject: [PATCH] Correct parameter order of pexpect.expect_prompt Ensure that the increment= param is set via keyword, not via positional arg. This mistake was masking a bug where the "^a b c" match was not being tested, because it was being set as the value for increment! --- build_tools/pexpect_helper.py | 2 +- tests/pexpects/bind.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build_tools/pexpect_helper.py b/build_tools/pexpect_helper.py index 17afc405d..9e6f4e9a6 100644 --- a/build_tools/pexpect_helper.py +++ b/build_tools/pexpect_helper.py @@ -200,7 +200,7 @@ class SpawnedProc(object): """ Cover over expect_re() which accepts a literal string. """ return self.expect_re(re.escape(s), **kwargs) - def expect_prompt(self, increment=True, *args, **kwargs): + def expect_prompt(self, *args, increment=True, **kwargs): """ Convenience function which matches some text and then a prompt. Match the given positional arguments as expect_re, and then look for a prompt. diff --git a/tests/pexpects/bind.py b/tests/pexpects/bind.py index 1cd16de0c..c7d4d8612 100644 --- a/tests/pexpects/bind.py +++ b/tests/pexpects/bind.py @@ -283,9 +283,9 @@ expect_prompt() send("a b c d\x01") # ctrl-a, move back to the beginning of the line send("\x07") # ctrl-g, kill bigword sendline("echo") -expect_prompt("^b c d") +expect_prompt("\nb c d") send(" a b c d\x01") # ctrl-a, move back to the beginning of the line send("\x07") # ctrl-g, kill bigword sendline("echo") -expect_prompt("^b c d") +expect_prompt("\nb c d")