summaryrefslogtreecommitdiff
path: root/test/lib/minitest
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-24 07:09:29 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-24 07:09:29 +0000
commit36f3ee6dc876377cdef28da601dfe2f4e45e0f39 (patch)
treef9f6d8c664385e60f96cfca5c46ce68680c3777c /test/lib/minitest
parente30e8702a3d41f75bc525989a6bf6a7fd95472a5 (diff)
* test/lib/minitest/unit.rb (parallelize_me!): Removed.
This fixes the line-by-line structure of the test result in verbose mode. [ruby-core:54905] * test/lib/minitest/parallel_each.rb: Removed. * test/minitest/test_minitest_mock.rb: Don't call parallelize_me!. * test/minitest/test_minitest_spec.rb: Ditto. * test/minitest/test_minitest_unit.rb: Ditto. Tests for parallel feature removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/lib/minitest')
-rw-r--r--test/lib/minitest/parallel_each.rb75
-rw-r--r--test/lib/minitest/unit.rb16
2 files changed, 0 insertions, 91 deletions
diff --git a/test/lib/minitest/parallel_each.rb b/test/lib/minitest/parallel_each.rb
deleted file mode 100644
index 07e4e20..0000000
--- a/test/lib/minitest/parallel_each.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-# encoding: utf-8
-
-##
-# Provides a parallel #each that lets you enumerate using N threads.
-# Use environment variable N to customize. Defaults to 2. Enumerable,
-# so all the goodies come along (tho not all are wrapped yet to
-# return another ParallelEach instance).
-
-class ParallelEach
- require 'thread'
- include Enumerable
-
- ##
- # How many Threads to use for this parallel #each.
-
- N = (ENV['N'] || 2).to_i
-
- ##
- # Create a new ParallelEach instance over +list+.
-
- def initialize list
- @queue = Queue.new # *sigh*... the Queue api sucks sooo much...
-
- list.each { |i| @queue << i }
- N.times { @queue << nil }
- end
-
- def grep pattern # :nodoc:
- self.class.new super
- end
-
- def select(&block) # :nodoc:
- self.class.new super
- end
-
- alias find_all select # :nodoc:
-
- ##
- # Starts N threads that yield each element to your block. Joins the
- # threads at the end.
-
- def each
- threads = N.times.map {
- Thread.new do
- Thread.current.abort_on_exception = true
- while job = @queue.pop
- yield job
- end
- end
- }
- threads.map(&:join)
- end
-
- def count
- [@queue.size - N, 0].max
- end
-
- alias_method :size, :count
-end
-
-class MiniTest::Unit
- alias _old_run_suites _run_suites
-
- ##
- # Runs all the +suites+ for a given +type+. Runs suites declaring
- # a test_order of +:parallel+ in parallel, and everything else
- # serial.
-
- def _run_suites suites, type
- parallel, serial = suites.partition { |s| s.test_order == :parallel }
-
- ParallelEach.new(parallel).map { |suite| _run_suite suite, type } +
- serial.map { |suite| _run_suite suite, type }
- end
-end
diff --git a/test/lib/minitest/unit.rb b/test/lib/minitest/unit.rb
index 9b9b9e9..c6489ba 100644
--- a/test/lib/minitest/unit.rb
+++ b/test/lib/minitest/unit.rb
@@ -902,8 +902,6 @@ module MiniTest
##
# Runs all the +suites+ for a given +type+.
#
- # NOTE: this method is redefined in parallel_each.rb, which is
- # loaded if a test-suite calls parallelize_me!.
def _run_suites suites, type
suites.map { |suite| _run_suite suite, type }
@@ -1346,20 +1344,6 @@ module MiniTest
end
end
- ##
- # Call this at the top of your tests when you want to run your
- # tests in parallel. In doing so, you're admitting that you rule
- # and your tests are awesome.
-
- def self.parallelize_me!
- require "minitest/parallel_each"
-
- class << self
- undef_method :test_order if method_defined? :test_order
- define_method :test_order do :parallel end
- end
- end
-
def self.inherited klass # :nodoc:
@@test_suites[klass] = true
super