class Minitest::Parallel::Executor

The engine used to run multiple tests in parallel.



The size of the pool of workers.

Public Class Methods

new(size) click to toggle source

Create a parallel test executor of with size workers.

# File lib/minitest/parallel.rb, line 17
def initialize size
  @size  = size
  @queue =
  @pool  = nil

Public Instance Methods

<<(work;) click to toggle source

Add a job to the queue

# File lib/minitest/parallel.rb, line 43
def << work; @queue << work; end
shutdown() click to toggle source

Shuts down the pool of workers by signalling them to quit and waiting for them all to finish what they’re currently working on.

# File lib/minitest/parallel.rb, line 50
def shutdown
  size.times { @queue << nil }
start() click to toggle source

Start the executor

# File lib/minitest/parallel.rb, line 26
def start
  @pool  = { do |queue|
      Thread.current.abort_on_exception = true
      while (job = queue.pop)
        klass, method, reporter = job
        reporter.synchronize { reporter.prerecord klass, method }
        result = Minitest.run_one_method klass, method
        reporter.synchronize { reporter.record result }