bin/parallel_test in parallel_tests-0.4.0 vs bin/parallel_test in parallel_tests-0.4.1
- old
+ new
@@ -1,10 +1,11 @@
#!/usr/bin/env ruby
require 'rubygems'
require 'optparse'
-lib_folder = File.join(File.dirname(__FILE__), '..', 'lib')
-require File.join(lib_folder, "parallel_tests")
+require 'parallel'
+$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
+require "parallel_tests"
options = {}
OptionParser.new do |opts|
opts.banner = <<BANNER
Run tests in parallel, giving each process ENV['TEST_ENV_NUMBER'] ('', '2', '3', ...)
@@ -24,27 +25,25 @@
end.parse!
# get files to run from arguments
options[:files] = ARGV if ARGV.size > 0
-require 'parallel'
num_processes = options[:count] || Parallel.processor_count
num_processes = num_processes * (options[:multiply] || 1)
if options[:execute]
- require File.join(lib_folder, "parallel_tests")
Parallel.in_processes(num_processes) do |i|
ParallelTests.execute_command(options[:execute], i)
end
else
lib, name, task = {
'test' => ["tests", "test", "test"],
'spec' => ["specs", "spec", "spec"],
'features' => ["cucumber", "feature", "features"]
}[options[:type]||'test']
- require File.join(lib_folder, "parallel_#{lib}")
+ require "parallel_#{lib}"
klass = eval("Parallel#{lib.capitalize}")
start = Time.now
tests_folder = File.join(task, options[:path_prefix].to_s)
@@ -75,6 +74,6 @@
#exit with correct status code
# - rake parallel:test && echo 123 ==> 123 should not show up when test failed
# - rake parallel:test db:reset ==> works when tests succeed
abort "#{name.capitalize}s Failed" if klass.failed?(results)
-end
+end
\ No newline at end of file