From c672bdd8f5b17e53fc445d74bbcb0342c3f96270 Mon Sep 17 00:00:00 2001 From: Alexandre Barret Date: Mon, 9 Dec 2024 09:59:44 +1300 Subject: [PATCH] fixup! Enable test helper for all --- features/bundler-app/retest/support/test_helper.rb | 11 ++++------- features/git-ruby/retest/support/test_helper.rb | 9 +++------ features/hanami-app/retest/support/test_helper.rb | 9 +++------ features/rails-app/retest/support/test_helper.rb | 5 +---- features/rspec-rails/retest/support/test_helper.rb | 5 +---- features/rspec-ruby/retest/support/test_helper.rb | 5 +---- features/ruby-app/retest/support/test_helper.rb | 5 +---- 7 files changed, 14 insertions(+), 35 deletions(-) diff --git a/features/bundler-app/retest/support/test_helper.rb b/features/bundler-app/retest/support/test_helper.rb index 47ae6a8..5743134 100644 --- a/features/bundler-app/retest/support/test_helper.rb +++ b/features/bundler-app/retest/support/test_helper.rb @@ -3,21 +3,18 @@ module RetestHelper # COMMAND - def launch_retest(command, sleep_seconds: Float(ENV.fetch('LAUNCH_SLEEP_SECONDS', 1.5))) + def launch_retest(command, sleep_for: Float(ENV.fetch('LAUNCH_SLEEP_SECONDS', 1.5))) require 'open3' @input, @output, @stderr, @wait_thr = Open3.popen3(command) @pid = @wait_thr[:pid] - sleep sleep_seconds + sleep sleep_for end def end_retest @input&.close @stderr&.close @output&.close - if @pid - Process.kill('SIGHUP', @pid) - Process.detach(@pid) - end + @wait_thr.exit end # ASSERTIONS @@ -42,7 +39,7 @@ def read_output(output = @output) result = "" loop do result += output.read_nonblock(1024) - rescue IO::WaitReadable + rescue IO::WaitReadable, EOFError break end diff --git a/features/git-ruby/retest/support/test_helper.rb b/features/git-ruby/retest/support/test_helper.rb index 0a08967..5743134 100644 --- a/features/git-ruby/retest/support/test_helper.rb +++ b/features/git-ruby/retest/support/test_helper.rb @@ -3,21 +3,18 @@ module RetestHelper # COMMAND - def launch_retest(command, sleep_seconds: Float(ENV.fetch('LAUNCH_SLEEP_SECONDS', 1.5))) + def launch_retest(command, sleep_for: Float(ENV.fetch('LAUNCH_SLEEP_SECONDS', 1.5))) require 'open3' @input, @output, @stderr, @wait_thr = Open3.popen3(command) @pid = @wait_thr[:pid] - sleep sleep_seconds + sleep sleep_for end def end_retest @input&.close @stderr&.close @output&.close - if @pid - Process.kill('SIGHUP', @pid) - Process.detach(@pid) - end + @wait_thr.exit end # ASSERTIONS diff --git a/features/hanami-app/retest/support/test_helper.rb b/features/hanami-app/retest/support/test_helper.rb index 0a08967..5743134 100644 --- a/features/hanami-app/retest/support/test_helper.rb +++ b/features/hanami-app/retest/support/test_helper.rb @@ -3,21 +3,18 @@ module RetestHelper # COMMAND - def launch_retest(command, sleep_seconds: Float(ENV.fetch('LAUNCH_SLEEP_SECONDS', 1.5))) + def launch_retest(command, sleep_for: Float(ENV.fetch('LAUNCH_SLEEP_SECONDS', 1.5))) require 'open3' @input, @output, @stderr, @wait_thr = Open3.popen3(command) @pid = @wait_thr[:pid] - sleep sleep_seconds + sleep sleep_for end def end_retest @input&.close @stderr&.close @output&.close - if @pid - Process.kill('SIGHUP', @pid) - Process.detach(@pid) - end + @wait_thr.exit end # ASSERTIONS diff --git a/features/rails-app/retest/support/test_helper.rb b/features/rails-app/retest/support/test_helper.rb index 9e00fc8..5743134 100644 --- a/features/rails-app/retest/support/test_helper.rb +++ b/features/rails-app/retest/support/test_helper.rb @@ -14,10 +14,7 @@ def end_retest @input&.close @stderr&.close @output&.close - if @pid - Process.kill('SIGHUP', @pid) - Process.detach(@pid) - end + @wait_thr.exit end # ASSERTIONS diff --git a/features/rspec-rails/retest/support/test_helper.rb b/features/rspec-rails/retest/support/test_helper.rb index 9e00fc8..5743134 100644 --- a/features/rspec-rails/retest/support/test_helper.rb +++ b/features/rspec-rails/retest/support/test_helper.rb @@ -14,10 +14,7 @@ def end_retest @input&.close @stderr&.close @output&.close - if @pid - Process.kill('SIGHUP', @pid) - Process.detach(@pid) - end + @wait_thr.exit end # ASSERTIONS diff --git a/features/rspec-ruby/retest/support/test_helper.rb b/features/rspec-ruby/retest/support/test_helper.rb index 9e00fc8..5743134 100644 --- a/features/rspec-ruby/retest/support/test_helper.rb +++ b/features/rspec-ruby/retest/support/test_helper.rb @@ -14,10 +14,7 @@ def end_retest @input&.close @stderr&.close @output&.close - if @pid - Process.kill('SIGHUP', @pid) - Process.detach(@pid) - end + @wait_thr.exit end # ASSERTIONS diff --git a/features/ruby-app/retest/support/test_helper.rb b/features/ruby-app/retest/support/test_helper.rb index 9e00fc8..5743134 100644 --- a/features/ruby-app/retest/support/test_helper.rb +++ b/features/ruby-app/retest/support/test_helper.rb @@ -14,10 +14,7 @@ def end_retest @input&.close @stderr&.close @output&.close - if @pid - Process.kill('SIGHUP', @pid) - Process.detach(@pid) - end + @wait_thr.exit end # ASSERTIONS