tests: Stop sleeping before expect

It's useless - `expect` has a timeout anyway, and it defaults to 5s,
so these 0.5s sleeps just mean it'll always take at least 0.5s.

Sometimes it is useful to let things settle before *sending* text, and
it would be nice to be able to set the timeout for each expect
separately, but just adding to the timeout isn't useful.
This commit is contained in:
Fabian Homborg 2020-08-08 15:46:14 +02:00
parent 2c1148e3b5
commit 46faf0869c

View File

@ -22,9 +22,7 @@ expect_prompt()
# fish_job_summary is called when background job ends. # fish_job_summary is called when background job ends.
sendline("sleep 0.5 &") sendline("sleep 0.5 &")
sleep(0.050)
expect_prompt() expect_prompt()
sleep(0.550)
expect_re("[0-9]+:0:sleep 0.5 &:ENDED") expect_re("[0-9]+:0:sleep 0.5 &:ENDED")
sendline("") sendline("")
expect_prompt() expect_prompt()
@ -32,10 +30,8 @@ expect_prompt()
# fish_job_summary is called when background job is signalled. # fish_job_summary is called when background job is signalled.
# cmd_line correctly prints only the actually backgrounded job. # cmd_line correctly prints only the actually backgrounded job.
sendline("false; sleep 10 &; true") sendline("false; sleep 10 &; true")
sleep(0.100)
expect_prompt() expect_prompt()
sendline("kill -TERM $last_pid") sendline("kill -TERM $last_pid")
sleep(0.100)
expect_re("[0-9]+:0:sleep 10 &:SIGTERM:Polite quit request") expect_re("[0-9]+:0:sleep 10 &:SIGTERM:Polite quit request")
sendline("") sendline("")
expect_prompt() expect_prompt()
@ -45,5 +41,4 @@ expect_prompt()
sendline("true | sleep 6") sendline("true | sleep 6")
sleep(0.100) sleep(0.100)
call(["pkill", "-KILL", "sleep", "-P", str(sp.spawn.pid)]) call(["pkill", "-KILL", "sleep", "-P", str(sp.spawn.pid)])
sleep(0.100)
expect_re("[0-9]+:1:true|sleep 6:SIGKILL:Forced quit:[0-9]+:sleep") expect_re("[0-9]+:1:true|sleep 6:SIGKILL:Forced quit:[0-9]+:sleep")