How do I use parallel testing in Ruby 1.9.3?

(Cross-posting from

)

Given the following file

Modified from

replication.rb

require ‘test/unit’
class TestTest < Test::Unit::TestCase
def test_one
assert true
end

def test_two
assert true
end
end

and Ruby 1.9.3

$ /usr/bin/ruby1.9.1 --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]

$ /usr/bin/ruby1.9.1 replication.rb --help
Usage: replication [options]
minitest options:
-h, --help Display this help.
-s, --seed SEED Sets random seed
-v, --verbose Verbose. Show progress processing
files.
-n, --name PATTERN Filter test names on pattern.
–jobs-status [TYPE] Show status of jobs every file;
Disabled when --jobs isn’t specified.
-j, --jobs N Allow run tests with N jobs at once
–no-retry Don’t retry running testcase when
–jobs specified
–ruby VAL Path to ruby; It’ll have used at -j
option
-q, --hide-skip Hide skipped tests
-b, --basedir=DIR Base directory of test suites.
-x, --exclude PATTERN Exclude test files on pattern.
-Idirectory Add library load path
–[no-]gc-stress Set GC.stress as true

I’m able to run tests non-parallelized:

$ /usr/bin/ruby1.9.1 replication.rb
Run options:

Running tests:

Finished tests in 0.000458s, 4368.4051 tests/s, 4368.4051 assertions/s.

2 tests, 2 assertions, 0 failures, 0 errors, 0 skips

But not in parallel:

$ /usr/bin/ruby1.9.1 replication.rb --jobs=2 --ruby /usr/bin/ruby1.9.1
Run options: --jobs=2 --ruby /usr/bin/ruby1.9.1

Running tests:

Retrying…

Finished tests in 0.037315s, 0.0000 tests/s, 0.0000 assertions/s.

0 tests, 0 assertions, 0 failures, 0 errors, 0 skips

I’ve also found this to be the case on both Ubuntu (12.04) and OS X
(snow leopard).

Do I need to be using rake in order to do parallel testing? Or have I
done something else wrong?

Thanks,

Andrew Grimm

–no-retry throws errors as well:

» replicate.rb --jobs=2 --no-retry
Run options: --jobs=2 --no-retry

Running tests:

/home/karatedog/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1
/test/unit.rb:522:in
+': nil can't be coerced into Fixnum (TypeError) from /home/karatedog/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:522:in_run_parallel’
from

from
/home/karatedog/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:325:in
`block in autorun’