AS::Isolation functional on Windows/JRuby.

Doesn't make up for the fact that it's slooooooooow, though.

Signed-off-by: wycats <wycats@gmail.com>
This commit is contained in:
Nick Sieger 2010-06-15 15:28:19 -05:00 committed by wycats
parent 7710a8cb6b
commit b549d93d2f
2 changed files with 11 additions and 10 deletions

View File

@ -45,12 +45,16 @@ module ActiveSupport
end end
end end
module TestUnit def _run_class_setup # class setup method should only happen in parent
def run(result) unless defined?(@@ran_class_setup) || ENV['ISOLATION_TEST']
unless defined?(@@ran_class_setup)
self.class.setup if self.class.respond_to?(:setup) self.class.setup if self.class.respond_to?(:setup)
@@ran_class_setup = true @@ran_class_setup = true
end end
end
module TestUnit
def run(result)
_run_class_setup
yield(Test::Unit::TestCase::STARTED, name) yield(Test::Unit::TestCase::STARTED, name)
@ -74,10 +78,7 @@ module ActiveSupport
module MiniTest module MiniTest
def run(runner) def run(runner)
unless defined?(@@ran_class_setup) _run_class_setup
self.class.setup if self.class.respond_to?(:setup)
@@ran_class_setup = true
end
serialized = run_in_isolation do |isolated_runner| serialized = run_in_isolation do |isolated_runner|
super(isolated_runner) super(isolated_runner)
@ -109,6 +110,8 @@ module ActiveSupport
end end
module Subprocess module Subprocess
ORIG_ARGV = ARGV.dup unless defined?(ORIG_ARGV)
# Crazy H4X to get this working in windows / jruby with # Crazy H4X to get this working in windows / jruby with
# no forking. # no forking.
def run_in_isolation(&blk) def run_in_isolation(&blk)

View File

@ -1,5 +1,3 @@
ORIG_ARGV = ARGV.dup
require File.expand_path("../../../load_paths", __FILE__) require File.expand_path("../../../load_paths", __FILE__)
require 'stringio' require 'stringio'