From 0874dd6a965a3baf160ef4c656d6635b92f87cdc Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Tue, 15 Aug 2023 19:11:41 +0200 Subject: [PATCH] pexpects: Fix spurious failure in generic.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This used expect_re with a regex ending in `.*`, followed by an `expect_prompt`. This meant that, depending on the timing, the regex could swallow the prompt marker, which caused extremely confusing output like >Testing file pexpects/generic.py:Failed to match pattern: prompt 14 > ... > OUTPUT +1.33 ms (Line 70): \rprompt 13>functions\r\nN_, abbr, > alias, bg, cd, [SNIP], up-or-search, vared, wait\r\n⏎ > \r⏎ \r\rprompt 14> Yeah - it shows that "prompt 14" was in the output and it can't find "prompt 14". I could reproduce the failure locally when running the tests repeatedly. I got one after 17 attempts and so far haven't been able to reproduce it with this change applied. --- tests/pexpects/generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/pexpects/generic.py b/tests/pexpects/generic.py index 8f509aa76..e964db82a 100644 --- a/tests/pexpects/generic.py +++ b/tests/pexpects/generic.py @@ -67,5 +67,5 @@ expect_prompt() # See that `functions` terminates sendline("functions") -expect_re(".*fish_prompt,.*") +expect_re(".*fish_prompt,") expect_prompt()