Permalink
Browse files

moving mutex to the runner

  • Loading branch information...
1 parent 0807c0f commit 246c0f8f304b2f39bb6c5d8e967899213f7ede2b @tenderlove committed Oct 24, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/minitest/unit.rb
View
@@ -468,7 +468,7 @@ def capture_io
captured_stdout, captured_stderr = StringIO.new, StringIO.new
- @__mutex__.synchronize do
+ __mutex__.synchronize do
orig_stdout, orig_stderr = $stdout, $stderr
$stdout, $stderr = captured_stdout, captured_stderr
@@ -503,7 +503,7 @@ def capture_subprocess_io
captured_stdout, captured_stderr = Tempfile.new("out"), Tempfile.new("err")
- @__mutex__.synchronize do
+ __mutex__.synchronize do
orig_stdout, orig_stderr = $stdout.dup, $stderr.dup
$stdout.reopen captured_stdout
$stderr.reopen captured_stderr
@@ -885,6 +885,7 @@ def _run_suite suite, type
assertions = suite.send("#{type}_methods").grep(filter).map { |method|
inst = suite.new method
+ inst.__mutex__ = @mutex
inst._assertions = 0
print "#{suite}##{method} = " if @verbose
@@ -952,6 +953,7 @@ def initialize # :nodoc:
@report = []
@errors = @failures = @skips = 0
@verbose = false
+ @mutex = Mutex.new
end
def process_args args = [] # :nodoc:
@@ -1239,6 +1241,7 @@ class TestCase
extend Guard
attr_reader :__name__ # :nodoc:
+ attr_accessor :__mutex__ # :nodoc:
PASSTHROUGH_EXCEPTIONS = [NoMemoryError, SignalException,
Interrupt, SystemExit] # :nodoc:

0 comments on commit 246c0f8

Please sign in to comment.