From 8cbff4fe45abbca816867f388c12df19a211e7b9 Mon Sep 17 00:00:00 2001 From: Naoto Ono Date: Mon, 3 Feb 2025 16:07:19 +0900 Subject: [PATCH] Add sleep to PTY tests to stabilize flaky failures (#12691) --- test/test_pty.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/test_pty.rb b/test/test_pty.rb index 1c0c6fb3e8..81b0d394ff 100644 --- a/test/test_pty.rb +++ b/test/test_pty.rb @@ -12,7 +12,7 @@ class TestPTY < Test::Unit::TestCase RUBY = EnvUtil.rubybin def test_spawn_without_block - r, w, pid = PTY.spawn(RUBY, '-e', 'puts "a"') + r, w, pid = PTY.spawn(RUBY, '-e', 'puts "a"; sleep 0.1') rescue RuntimeError omit $! else @@ -24,7 +24,7 @@ class TestPTY < Test::Unit::TestCase end def test_spawn_with_block - PTY.spawn(RUBY, '-e', 'puts "b"') {|r,w,pid| + PTY.spawn(RUBY, '-e', 'puts "b"; sleep 0.1') {|r,w,pid| begin assert_equal("b\r\n", r.gets) ensure @@ -38,7 +38,7 @@ class TestPTY < Test::Unit::TestCase end def test_commandline - commandline = Shellwords.join([RUBY, '-e', 'puts "foo"']) + commandline = Shellwords.join([RUBY, '-e', 'puts "foo"; sleep 0.1']) PTY.spawn(commandline) {|r,w,pid| begin assert_equal("foo\r\n", r.gets) @@ -53,7 +53,7 @@ class TestPTY < Test::Unit::TestCase end def test_argv0 - PTY.spawn([RUBY, "argv0"], '-e', 'puts "bar"') {|r,w,pid| + PTY.spawn([RUBY, "argv0"], '-e', 'puts "bar"; sleep 0.1') {|r,w,pid| begin assert_equal("bar\r\n", r.gets) ensure