class Minitest::Parallel::Executor
The engine used to run multiple tests in parallel.
The engine used to run multiple tests in parallel.
Attributes
size
[R]
untyped
The size of the pool of workers.
The size of the pool of workers.
Public Class Methods
(untyped size) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest/parallel.rb, line 19 def initialize size @size = size @queue = Thread::Queue.new @pool = nil end
Create a parallel test executor of with size workers.
Create a parallel test executor of with size workers.
Public Instance Methods
(untyped work) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest/parallel.rb, line 45 def << work; @queue << work; end
Add a job to the queue
Add a job to the queue
() → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest/parallel.rb, line 52 def shutdown size.times { @queue << nil } @pool.each(&:join) end
Shuts down the pool of workers by signalling them to quit and waiting for them all to finish what they’re currently working on.
Shuts down the pool of workers by signalling them to quit and waiting for them all to finish what they’re currently working on.
() → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/minitest-6.0.6/lib/minitest/parallel.rb, line 28 def start @pool = Array.new(size) { Thread.new @queue do |queue| Thread.current.abort_on_exception = true while job = queue.pop do klass, method, reporter = job reporter.synchronize { reporter.prerecord klass, method } result = klass.new(method).run reporter.synchronize { reporter.record result } end end } end
Start the executor
Start the executor