diff options
author | Jamis Buck <jamis@37signals.com> | 2011-01-19 15:55:23 -0700 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2011-01-19 15:55:23 -0700 |
commit | 41f76946d02e571a2483eccb72632960125e122b (patch) | |
tree | 7bb83409467583249874d5cd16a7d9ae36f1b102 | |
parent | 262b2ea8cda20999ddf8c4bf13b7a70453e996d2 (diff) | |
download | rails-41f76946d02e571a2483eccb72632960125e122b.tar.gz rails-41f76946d02e571a2483eccb72632960125e122b.tar.bz2 rails-41f76946d02e571a2483eccb72632960125e122b.zip |
Revert "rein in GC during tests by making them run (at most) once per second"
This reverts commit 16a23a184e8b091392c0b6001a025bee8323ec8e.
-rw-r--r-- | activesupport/lib/active_support/testing/garbage_collection.rb | 24 | ||||
-rw-r--r-- | activesupport/test/test_test.rb | 8 |
2 files changed, 4 insertions, 28 deletions
diff --git a/activesupport/lib/active_support/testing/garbage_collection.rb b/activesupport/lib/active_support/testing/garbage_collection.rb index 23ac745c3e..7bf9fbafa6 100644 --- a/activesupport/lib/active_support/testing/garbage_collection.rb +++ b/activesupport/lib/active_support/testing/garbage_collection.rb @@ -3,9 +3,6 @@ module ActiveSupport module GarbageCollection def self.included(base) base.teardown :scrub_leftover_instance_variables - - base.setup :begin_gc_deferment - base.teardown :reconsider_gc_deferment end private @@ -17,27 +14,6 @@ module ActiveSupport remove_instance_variable(var) end end - - # Minimum interval, in seconds, at which to run GC. Might be less - # frequently than this, if a single test takes longer than this to - # run. - DEFERRED_GC_THRESHOLD = (ENV['DEFERRED_GC_THRESHOLD'] || 1.0).to_f - - @@last_gc_run = Time.now - - def begin_gc_deferment - GC.disable if DEFERRED_GC_THRESHOLD > 0 - end - - def reconsider_gc_deferment - if DEFERRED_GC_THRESHOLD > 0 && Time.now - @@last_gc_run >= DEFERRED_GC_THRESHOLD - GC.enable - GC.start - GC.disable - - @@last_gc_run = Time.now - end - end end end end diff --git a/activesupport/test/test_test.rb b/activesupport/test/test_test.rb index fa86053301..ea652844f5 100644 --- a/activesupport/test/test_test.rb +++ b/activesupport/test/test_test.rb @@ -135,9 +135,9 @@ class SetupAndTeardownTest < ActiveSupport::TestCase teardown :foo, :sentinel, :foo def test_inherited_setup_callbacks - assert_equal [:begin_gc_deferment, :reset_callback_record, :foo], self.class._setup_callbacks.map(&:raw_filter) + assert_equal [:reset_callback_record, :foo], self.class._setup_callbacks.map(&:raw_filter) assert_equal [:foo], @called_back - assert_equal [:scrub_leftover_instance_variables, :reconsider_gc_deferment, :foo, :sentinel, :foo], self.class._teardown_callbacks.map(&:raw_filter) + assert_equal [:scrub_leftover_instance_variables, :foo, :sentinel, :foo], self.class._teardown_callbacks.map(&:raw_filter) end def setup @@ -167,9 +167,9 @@ class SubclassSetupAndTeardownTest < SetupAndTeardownTest teardown :bar def test_inherited_setup_callbacks - assert_equal [:begin_gc_deferment, :reset_callback_record, :foo, :bar], self.class._setup_callbacks.map(&:raw_filter) + assert_equal [:reset_callback_record, :foo, :bar], self.class._setup_callbacks.map(&:raw_filter) assert_equal [:foo, :bar], @called_back - assert_equal [:scrub_leftover_instance_variables, :reconsider_gc_deferment, :foo, :sentinel, :foo, :bar], self.class._teardown_callbacks.map(&:raw_filter) + assert_equal [:scrub_leftover_instance_variables, :foo, :sentinel, :foo, :bar], self.class._teardown_callbacks.map(&:raw_filter) end protected |