开发者

Why are tests running in production mode and causing my script/runners to fail?

So I have some script/runners set up in a cron job, but according to the logs, I'm getting this error below. First, I'm not sure why Test::Unit automatic runner is happening in production to begin with. I don't have autospec or autotest going on. Secondly, I'm not sure how to resolve this pesky invalid option error. I'm using the javan-whenever gem to handle the cron schedule. Any help out there?

0 tests, 0 assertions, 0 failures, 0 errors

invalid option: -e
Test::Unit automatic runner.
Usage: /apps/ion/releases/20091210210633/script/runner [options] [-- untouched arguments]

-r, --runner=RUNNER              Use the given RUNNER.
                                 (c[onsole], f[ox], g[tk], g[tk]2, t[k])
-n, --name=NAME                  Runs tests matching NAME.
                                 (patterns may be used).
-t, --testcase=TESTCASE          Runs tests in TestCases matching TESTCASE.
                                 (patterns may be used).
-I, --load-path=DIR[:DIR...]     Appends directo开发者_如何学Cry list to $LOAD_PATH.
-v, --verbose=[LEVEL]            Set the output level (default is verbose).
                                 (s[ilent], p[rogress], n[ormal], v[erbose])
    --                           Stop processing options so that the
                                 remaining options will be passed to the
                                 test.
-h, --help                       Display this help.

Deprecated options:
    --console                    Console runner (use --runner).
    --gtk                        GTK runner (use --runner).
    --fox                        Fox runner (use --runner).


This is because something in your environment is requiring Test::Unit. I was having the same problem running rails runner in a Rails 3.1.0 application, and it was because we had gem test-unit in our Gemfile for all groups, rather than just for the test group where it was actually needed. Once I moved it into the test group, my runners ran as expected.

This code seems to be the culprit:

# test_unit/lib/test/unit.rb
at_exit do
  unless $! || Test::Unit.run?
    exit Test::Unit::AutoRunner.run
  end
end

If you can't remove the requirement on Test::Unit, you can add this hack somewhere in your environment to prevent AutoRunner from auto-running:

Test::Unit.run = true
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜