gem --run-tests problems

John Poole's Avatar

John Poole

11 Mar, 2011 02:11 PM

The documentation at states:

5.6 --run-tests Unit tests will be run after a gem is installed. If the gem does not contain any unit tests, then a message will be printed to that effect. This modifier applies to installation of gems only.

When I try "--run-tests", I get this error:

 D:\work\Ruby>gem install pg --run-tests -- --with-pg-dir=C:/Progra~1/Postgr~1/8.
 ERROR:  While executing gem ... (OptionParser::InvalidOption)
     invalid option: --run-tests


I also tried "gem install pg --force --run-tests -- --with-pg-dir=C:/Progra~1/Postgr~1/8.4" and get the same error message. Note, when I run "gem install pg --force -- --with-pg-dir=C:/Progra~1/Postgr~1/8.4", the install proceeds and gives every indication the install was successful. However, when I try to run a simple script that attempts to invoke "pg", it errors out, so I want to see if there are any unit tests. The GEM documentation suggests that using "--run-tests" will either perform tests or alert that no unit test are available. The error message "invalid option" I am getting appears to be of a more fundamental type, not the type of error message stating that there are no unit tests to try.

  1. 1 Posted by Luis Lavena on 11 Mar, 2011 02:18 PM

    Luis Lavena's Avatar

    That is deprecated, documentation there needs to be updated:

    Please see

  2. 2 Posted by John Poole on 11 Mar, 2011 05:26 PM

    John Poole's Avatar

    Has the feature of advising if there are no tests been removed? I'm having a heck of a time trying to get Ruby to work with PostgreSQL, and I suspect is something as simple as a missing path. I was hoping the GEM installation of pg with testing might shed some light, but I'm guessing that there are no tests for the pg gem.

    It would be helpful if the "test_on_install" feature at least acknowledges it is activated and no tests were provided by the author.

    D:\work\Ruby>gem install pg --force -- --with-pg-dir=C:/Progra~1/Postgr~1/8.4 --
    test_on_install --install_development_dependencies
    Temporarily enhancing PATH to include DevKit...
    Building native extensions. This could take a while...
    Successfully installed pg-0.10.1
    1 gem installed
    Installing ri documentation for pg-0.10.1...
    Installing RDoc documentation for pg-0.10.1...

    D:\work\Ruby>ruby test_postgres.rb
    C:/Ruby/186/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_origina
    l_require': no such file to load -- 1.8/pg_ext (LoadError)

        from C:/Ruby/186/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in


        from C:/Ruby/186/lib/ruby/gems/1.8/gems/pg-0.10.1/lib/pg.rb:10
        from C:/Ruby/186/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in


        from C:/Ruby/186/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in


        from test_postgres.rb:2


  3. 3 Posted by Luis Lavena on 11 Mar, 2011 06:14 PM

    Luis Lavena's Avatar

    That is completely unrelated to RubyGems testing functionality.

    You should ask this to the PostgreSQL gem author:

    Since you're in Windows, I've reported issues with 0.10.0 to him, and
    I thought were fixed in 0.10.1:

    Ask the author.

  4. 4 Posted by John Poole on 11 Mar, 2011 06:22 PM

    John Poole's Avatar

    Thank you for forwarding the issue regarding pg on Windows; that will be helpful, I hope.

    I hope that side issue of my problems with "pg" did not detract from the issue that does directly concern RubyGems: the "test_on_install" gives no indication if it is activated and whether or not it found a test suite.

    I had included my sample run to illustrate a real live example where no indication appears in the console.

    The deprecated documentation suggests that a warning would issue if a test suite were not found. In my sample, there is nothing to suggest whether the "test_on_install" was activate or not and whether it found or did not find a test suite. If the "test_on_install" feature for gems is not appropriate for this forum, please advise which forum (or by bug/enhancement) should to utilized to bring this issue to the developer's attention.

  5. Support Staff 5 Posted by Eric Hodel on 16 Mar, 2011 12:06 AM

    Eric Hodel's Avatar

    I updated the documentation to remove --run-tests as it has been removed from rubygems in favor of the rubygems-test gem (See:

  6. Eric Hodel closed this discussion on 16 Mar, 2011 12:06 AM.

  7. John Poole re-opened this discussion on 16 Mar, 2011 05:49 AM

  8. 6 Posted by John Poole on 16 Mar, 2011 05:49 AM

    John Poole's Avatar

    C:\Documents and Settings\jlpoole>gem install rubygems-test
    ERROR: Error installing rubygems-test:

        rubygems-test requires Ruby version >= 1.8.7.

    C:\Documents and Settings\jlpoole>ruby -v
    ruby 1.8.6 (2010-02-04 patchlevel 398) [i386-mingw32]

    C:\Documents and Settings\jlpoole>

  9. Support Staff 7 Posted by Eric Hodel on 16 Mar, 2011 06:14 AM

    Eric Hodel's Avatar

    I don't see why you reopened this discussion with that output. It appears to be perfectly clear to me.

    RubyGems no longer has built-in support for running tests as it did not work and was too difficult to keep up to date.

    That support has been taken up by the rubygems-test gem and

    The rubygems-test gem requires ruby 1.8.7. If you wish to use it you will need to upgrade to a newer version of ruby.

  10. Eric Hodel closed this discussion on 16 Mar, 2011 06:14 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

20 Apr, 2018 02:50 PM
19 Apr, 2018 05:43 PM
11 Apr, 2018 10:06 AM
10 Apr, 2018 02:55 PM
09 Apr, 2018 06:42 PM