summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--test/lib/minitest/parallel_each.rb75
-rw-r--r--test/lib/minitest/unit.rb16
-rw-r--r--test/minitest/test_minitest_mock.rb4
-rw-r--r--test/minitest/test_minitest_spec.rb2
-rw-r--r--test/minitest/test_minitest_unit.rb55
6 files changed, 15 insertions, 152 deletions
diff --git a/ChangeLog b/ChangeLog
index 2cc4115958..3700b9d771 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+Sat May 24 15:49:39 2014 Tanaka Akira <akr@fsij.org>
+
+ * 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.
+
Sat May 24 15:29:10 2014 Tanaka Akira <akr@fsij.org>
* test/lib/minitest/hell.rb: Unused file removed.
diff --git a/test/lib/minitest/parallel_each.rb b/test/lib/minitest/parallel_each.rb
deleted file mode 100644
index 07e4e20179..0000000000
--- 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 9b9b9e99ce..c6489ba01e 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
diff --git a/test/minitest/test_minitest_mock.rb b/test/minitest/test_minitest_mock.rb
index 454769b3f3..062cda56ff 100644
--- a/test/minitest/test_minitest_mock.rb
+++ b/test/minitest/test_minitest_mock.rb
@@ -3,8 +3,6 @@
require 'minitest/autorun'
class TestMiniTestMock < MiniTest::Unit::TestCase
- parallelize_me!
-
def setup
@mock = MiniTest::Mock.new.expect(:foo, nil)
@mock.expect(:meaning_of_life, 42)
@@ -273,8 +271,6 @@ end
require "minitest/metametameta"
class TestMiniTestStub < MiniTest::Unit::TestCase
- parallelize_me!
-
def setup
super
MiniTest::Unit::TestCase.reset
diff --git a/test/minitest/test_minitest_spec.rb b/test/minitest/test_minitest_spec.rb
index bc52cbe346..54048ce694 100644
--- a/test/minitest/test_minitest_spec.rb
+++ b/test/minitest/test_minitest_spec.rb
@@ -593,8 +593,6 @@ class TestMetaStatic < MiniTest::Unit::TestCase
end
class TestMeta < MiniTest::Unit::TestCase
- parallelize_me!
-
def util_structure
x = y = z = nil
before_list = []
diff --git a/test/minitest/test_minitest_unit.rb b/test/minitest/test_minitest_unit.rb
index ec90d04f4e..aad0561cae 100644
--- a/test/minitest/test_minitest_unit.rb
+++ b/test/minitest/test_minitest_unit.rb
@@ -8,8 +8,6 @@ class AnError < StandardError; include MyModule; end
class ImmutableString < String; def inspect; super.freeze; end; end
class TestMiniTestUnit < MetaMetaMetaTestCase
- parallelize_me!
-
pwd = Pathname.new File.expand_path Dir.pwd
basedir = Pathname.new(File.expand_path "lib/minitest") + 'mini'
basedir = basedir.relative_path_from(pwd).to_s
@@ -558,56 +556,6 @@ class TestMiniTestRunner < MetaMetaMetaTestCase
@lock.synchronize { @cv.wait_while { @count > 0 } }
end
end
-
- def test_parallel_each_size
- assert_equal 0, ParallelEach.new([]).size
- end
-
- def test_run_parallel
- skip "I don't have ParallelEach debugged yet" if maglev?
-
- test_count = 2
- test_latch = Latch.new test_count
- main_latch = Latch.new
-
- thread = Thread.new {
- Thread.current.abort_on_exception = true
-
- # This latch waits until both test latches have been released. Both
- # latches can't be released unless done in separate threads because
- # `main_latch` keeps the test method from finishing.
- test_latch.await
- main_latch.release
- }
-
- Class.new MiniTest::Unit::TestCase do
- parallelize_me!
-
- test_count.times do |i|
- define_method :"test_wait_on_main_thread_#{i}" do
- test_latch.release
-
- # This latch blocks until the "main thread" releases it. The main
- # thread can't release this latch until both test latches have
- # been released. This forces the latches to be released in separate
- # threads.
- main_latch.await
- assert true
- end
- end
- end
-
- expected = clean <<-EOM
- ..
-
- Finished tests in 0.00
-
- 2 tests, 2 assertions, 0 failures, 0 errors, 0 skips
- EOM
-
- assert_report expected
- assert thread.join
- end
end
class TestMiniTestUnitOrder < MetaMetaMetaTestCase
@@ -1392,7 +1340,6 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
def test_capture_subprocess_io
@assertion_count = 0
- skip "Dunno why but the parallel run of this fails"
non_verbose do
out, err = capture_subprocess_io do
@@ -1756,8 +1703,6 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
end
class TestMiniTestGuard < MiniTest::Unit::TestCase
- parallelize_me!
-
def test_mri_eh
assert self.class.mri? "ruby blah"
assert self.mri? "ruby blah"