From 51e890030fd27c49abd0e0bb46abfd42edc8d0b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 10 Jul 2025 22:51:09 +0200 Subject: [PATCH] [rubygems/rubygems] Reset tmp directories before spec suite If you abort running test suite with a quick double Ctrl-C, tmp files will be left around, and they will interfere with the next test run. To avoid this, make sure to clear them once at the beginning of the test suite. ### Before ``` $ bin/parallel_rspec 16 processes for 175 specs, ~ 11 specs per process .............................................................................................^C^C Finished in 19.45 seconds (files took 0.42722 seconds to load) 94 examples, 0 failures (... turbo tests backtrace ...) $ bin/parallel_rspec 16 processes for 175 specs, ~ 11 specs per process .F....F....F...F......^C Failures: (... failures' details ...) ``` ### After ``` $ bin/parallel_rspec 16 processes for 175 specs, ~ 11 specs per process .................................................................................^C^C Finished in 18.18 seconds (files took 0.4383 seconds to load) 82 examples, 0 failures (... turbo tests backtrace ...) $ bin/parallel_rspec 16 processes for 175 specs, ~ 11 specs per process ................................................................................^C^C Finished in 8.79 seconds (files took 0.45187 seconds to load) 80 examples, 0 failures (... turbo tests backtrace ...) ``` https://github.com/rubygems/rubygems/commit/6767a52711 --- spec/bundler/spec_helper.rb | 2 +- spec/bundler/support/helpers.rb | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb index 559e830782..35b249bb92 100644 --- a/spec/bundler/spec_helper.rb +++ b/spec/bundler/spec_helper.rb @@ -103,7 +103,7 @@ RSpec.configure do |config| build_repo1 - reset_paths! + reset! end config.around :each do |example| diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb index 2657112663..acf13c9733 100644 --- a/spec/bundler/support/helpers.rb +++ b/spec/bundler/support/helpers.rb @@ -24,10 +24,6 @@ module Spec end FileUtils.mkdir_p(home) FileUtils.mkdir_p(tmpdir) - reset_paths! - end - - def reset_paths! Bundler.reset! Gem.clear_paths end