From 3af849d739bbf166e63be5dee665ab281ca735b0 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Tue, 2 Apr 2024 22:40:45 +0200 Subject: [PATCH] tests/pexpect: Fix \d escape --- tests/pexpects/history.py | 2 +- tests/pexpects/job_summary.py | 2 +- tests/pexpects/signals.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/pexpects/history.py b/tests/pexpects/history.py index e0bf7dc4f..b559f519d 100644 --- a/tests/pexpects/history.py +++ b/tests/pexpects/history.py @@ -65,7 +65,7 @@ expect_prompt("echo start2.*\r\necho start1") # Verify searching with a request for timestamps includes the timestamps. sendline("history search --show-time='# %F %T%n' --prefix 'echo start'") expect_prompt( - "# \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\r\necho start2; .*\r\n# \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\r\necho start1;" + "# \\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d\r\necho start2; .*\r\n# \\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d\r\necho start1;" ) # ========== diff --git a/tests/pexpects/job_summary.py b/tests/pexpects/job_summary.py index 9c864cd00..fa3d0d84e 100644 --- a/tests/pexpects/job_summary.py +++ b/tests/pexpects/job_summary.py @@ -45,7 +45,7 @@ expect_re("Job.*Group.*(CPU)?.*State.*Command") expect_re(".*running.*sleep 20 &") expect_prompt() sendline("echo $my_pid") -m = expect_re("\d+\r\n") +m = expect_re("\\d+\r\n") expect_prompt() os.kill(int(m.group()), signal.SIGTERM) expect_re("[0-9]+:0:sleep 20 &:SIGTERM:Polite quit request", timeout=20) diff --git a/tests/pexpects/signals.py b/tests/pexpects/signals.py index c3cb4af94..026df3ff1 100644 --- a/tests/pexpects/signals.py +++ b/tests/pexpects/signals.py @@ -83,10 +83,10 @@ expect_prompt() # Save the pids for later to check if they are still running. pids = [] send("sleep 130 & echo $last_pid\r") -pids += [expect_re("\d+\r\n").group().strip()] +pids += [expect_re("\\d+\r\n").group().strip()] expect_prompt() send("sleep 131 & echo $last_pid\r") -pids += [expect_re("\d+\r\n").group().strip()] +pids += [expect_re("\\d+\r\n").group().strip()] expect_prompt() send("sleep 9999999\r") sleep(0.500) # ensure fish kicks off the above sleep before it gets HUP - see #7288