Skip to content

Commit 8cbff4f

Browse files
authored
Add sleep to PTY tests to stabilize flaky failures (ruby#12691)
1 parent 890020e commit 8cbff4f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/test_pty.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class TestPTY < Test::Unit::TestCase
1212
RUBY = EnvUtil.rubybin
1313

1414
def test_spawn_without_block
15-
r, w, pid = PTY.spawn(RUBY, '-e', 'puts "a"')
15+
r, w, pid = PTY.spawn(RUBY, '-e', 'puts "a"; sleep 0.1')
1616
rescue RuntimeError
1717
omit $!
1818
else
@@ -24,7 +24,7 @@ def test_spawn_without_block
2424
end
2525

2626
def test_spawn_with_block
27-
PTY.spawn(RUBY, '-e', 'puts "b"') {|r,w,pid|
27+
PTY.spawn(RUBY, '-e', 'puts "b"; sleep 0.1') {|r,w,pid|
2828
begin
2929
assert_equal("b\r\n", r.gets)
3030
ensure
@@ -38,7 +38,7 @@ def test_spawn_with_block
3838
end
3939

4040
def test_commandline
41-
commandline = Shellwords.join([RUBY, '-e', 'puts "foo"'])
41+
commandline = Shellwords.join([RUBY, '-e', 'puts "foo"; sleep 0.1'])
4242
PTY.spawn(commandline) {|r,w,pid|
4343
begin
4444
assert_equal("foo\r\n", r.gets)
@@ -53,7 +53,7 @@ def test_commandline
5353
end
5454

5555
def test_argv0
56-
PTY.spawn([RUBY, "argv0"], '-e', 'puts "bar"') {|r,w,pid|
56+
PTY.spawn([RUBY, "argv0"], '-e', 'puts "bar"; sleep 0.1') {|r,w,pid|
5757
begin
5858
assert_equal("bar\r\n", r.gets)
5959
ensure

0 commit comments

Comments
 (0)