Skip to content

Commit 002519a

Browse files
committed
Support minitest 5.25+
Minitest 5.25+ has a new API for `with_info_handler` that accepts an additional argument. The code now support all versions of minitest 5. See minitest/minitest@8cd3b1c
1 parent 7cb7cb8 commit 002519a

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
source "https://rubygems.org"
44
gemspec
55

6-
gem "minitest", ">= 5.15.0"
6+
gem "minitest"
77

88
# We need a newish Rake since Active Job sets its test tasks' descriptions.
99
gem "rake", ">= 13"

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ GEM
348348
mini_magick (4.12.0)
349349
mini_mime (1.1.5)
350350
mini_portile2 (2.8.7)
351-
minitest (5.24.1)
351+
minitest (5.25.0)
352352
minitest-bisect (1.7.0)
353353
minitest-server (~> 1.0)
354354
path_expander (~> 1.1)
@@ -654,7 +654,7 @@ DEPENDENCIES
654654
libxml-ruby
655655
listen (~> 3.3)
656656
mdl (!= 0.13.0)
657-
minitest (>= 5.15.0)
657+
minitest
658658
minitest-bisect
659659
minitest-ci
660660
minitest-retry

activesupport/lib/active_support/testing/parallelization/worker.rb

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,29 @@ def perform_job(job)
4646

4747
set_process_title("#{klass}##{method}")
4848

49-
result = klass.with_info_handler reporter do
50-
Minitest.run_one_method(klass, method)
49+
result = nil
50+
51+
# TODO: Remove conditional when we support on minitest 5.25+
52+
if klass.method(:with_info_handler).arity == 2
53+
t0 = nil
54+
55+
handler = lambda do
56+
unless reporter.passed? then
57+
warn "Current results:"
58+
warn reporter.reporters.grep(SummaryReporter).first
59+
end
60+
61+
warn "Current: %s#%s %.2fs" % [klass, method, Minitest.clock_time - t0]
62+
end
63+
64+
result = klass.with_info_handler reporter, handler do
65+
t0 = Minitest.clock_time
66+
Minitest.run_one_method(klass, method)
67+
end
68+
else
69+
result = klass.with_info_handler reporter do
70+
Minitest.run_one_method(klass, method)
71+
end
5172
end
5273

5374
safe_record(reporter, result)

0 commit comments

Comments
 (0)