Sha256: 88bf442c4f9fea37518ddb768e147c236c0c3bff546bdaa05b77b95c6304b115
Contents?: true
Size: 987 Bytes
Versions: 2
Compression:
Stored size: 987 Bytes
Contents
module Minitest module Parallel class Executor attr_reader :size def initialize size @size = size @queue = Queue.new @pool = size.times.map { Thread.new(@queue) do |queue| Thread.current.abort_on_exception = true while job = queue.pop klass, method, reporter = job result = Minitest.run_one_method klass, method reporter.synchronize { reporter.record result } end end } end def << work; @queue << work; end def shutdown size.times { @queue << nil } @pool.each(&:join) end end module Test def _synchronize; Test.io_lock.synchronize { yield }; end module ClassMethods def run_one_method klass, method_name, reporter Minitest.parallel_executor << [klass, method_name, reporter] end def test_order; :parallel; end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
minitest-5.5.0 | lib/minitest/parallel.rb |
minitest-5.4.3 | lib/minitest/parallel.rb |