Rails 测试系统堆栈错误

发布于 2024-08-29 05:24:26 字数 2711 浏览 4 评论 0原文

我在暂停后恢复测试我的 Rails 应用程序。在我的 Rails 应用程序上运行测试现在会返回 SystemStackError。 这样的简单测试也

即使像def test_per_page

assert_instance_of Fixnum, Activity.per_page

end

给了我

C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/m odule/introspection.rb:74:在“local_constants”中:堆栈级别太深(SystemStac kError)

 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/introspection.rb:73:in `select'
 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/introspection.rb:73:in `local_constants'
 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/introspection.rb:86:in `local_constant_names'
 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:531:in `new_constants_in'
 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:525:in `collect'
 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:525:in `new_constants_in'
 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
 from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin/locator.rb:89:in `plugins'
  ... 12095 levels...
 from ./unit/../test_helper.rb:2
 from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
 from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
 from unit/my_test.rb:1

我发现我们安装了测试单元 gem 并删除了它。即使在那之后,同样的问题仍然不断出现。我安装了 rcov,在使用 rcov 时也做了同样的事情。

C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specation.rb:666:in `hash': 堆栈级别太深 (SystemStackError)

    from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `inject'
    from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:664:in `each'
    from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:664:in `inject'
    from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:664:in `hash'
    from C:/Ruby/lib/ruby/1.8/tsort.rb:219:in `[]='
    from C:/Ruby/lib/ruby/1.8/tsort.rb:219:in `each_strongly_connected_component_from'
    from C:/Ruby/lib/ruby/1.8/tsort.rb:219:in `each'
    from C:/Ruby/lib/ruby/1.8/tsort.rb:219:in `each_strongly_connected_component_from'
     ... 12099 levels...
    from C:/Ruby/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0-x86-mswin32/bin/rcov:554:in `load'
    from C:/Ruby/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0-x86-mswin32/bin/rcov:554
    from C:/Ruby/bin/rcov:19:in `load'
    from C:/Ruby/bin/rcov:19

有没有人跑过之前遇到过类似的事情..我知道 gem require 被一遍又一遍地调用..有没有办法解决这个问题?

I resumed testing my rails app after suspending it. Running tests on my rails app returns a SystemStackError now. Even a simple test like

def test_per_page

assert_instance_of Fixnum, Activity.per_page

end

is giving me

C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/m
odule/introspection.rb:74:in `local_constants': stack level too deep (SystemStac
kError)

 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/introspection.rb:73:in `select'
 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/introspection.rb:73:in `local_constants'
 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/module/introspection.rb:86:in `local_constant_names'
 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:531:in `new_constants_in'
 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:525:in `collect'
 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:525:in `new_constants_in'
 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
 from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin/locator.rb:89:in `plugins'
  ... 12095 levels...
 from ./unit/../test_helper.rb:2
 from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
 from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
 from unit/my_test.rb:1

I found that we had test-unit gem installed and removed it.. Even after that the same problem keeps popping up. I have rcov installed and same thing while using rcov also..

C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:666:in `hash': stack level too deep (SystemStackError)

    from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `inject'
    from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:664:in `each'
    from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:664:in `inject'
    from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/specification.rb:664:in `hash'
    from C:/Ruby/lib/ruby/1.8/tsort.rb:219:in `[]='
    from C:/Ruby/lib/ruby/1.8/tsort.rb:219:in `each_strongly_connected_component_from'
    from C:/Ruby/lib/ruby/1.8/tsort.rb:219:in `each'
    from C:/Ruby/lib/ruby/1.8/tsort.rb:219:in `each_strongly_connected_component_from'
     ... 12099 levels...
    from C:/Ruby/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0-x86-mswin32/bin/rcov:554:in `load'
    from C:/Ruby/lib/ruby/gems/1.8/gems/rcov-0.8.1.2.0-x86-mswin32/bin/rcov:554
    from C:/Ruby/bin/rcov:19:in `load'
    from C:/Ruby/bin/rcov:19

Has anyone ever ran into something like this before.. I understand that the gem require is getting called over and over again.. Is there a way around this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人间不值得 2024-09-05 05:24:26

哎呀!当环境启动时,我有两个为 rcov 运行的初始化程序。一个位于environment.rb 文件中,另一个位于config 文件夹中env 子文件夹中的单独test.rb 文件中。所以它不断地循环下去。无论如何,问题解决了,地球仍然在旋转。

谢谢

Ooops! I had two initializers running for rcov when the environment gets started. One in the environment.rb file and another in the separate test.rb file in the env sub-folder in the config folder. So it kept on going on and on in a continuous loop.. Anyway problem solved and the Earth is still revolving.

Thanks

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文