parallel_tests 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -62,13 +62,12 @@ Setup for non-rails
62
62
  Options are:
63
63
  -n [PROCESSES] How many processes to use, default: available CPUs
64
64
  -p, --path [PATH] run tests inside this path only
65
- -f path/to/test_file,path/to/other_test_file
66
- --files run these test files (comma-separated list w/o spaces)
65
+ --no-sort do not sort files before running them
67
66
  -r, --root [PATH] execute test commands from this path
68
67
  -f, --files [FILES] run these test files (comma-separated list w/o spaces)
69
68
  -m, --multiply-processes [FLOAT] use given number as a multiplier of processes to run
70
69
  -e, --exec [COMMAND] execute this code parallel and with ENV['TEST_ENV_NUM']
71
- -o, --test-options '[SOMETHING]' execute test commands with those options
70
+ -o, --test-options '[OPTIONS]' execute test commands with those options
72
71
  -t, --type [TYPE] which type of tests to run? test, spec or features
73
72
  -v, --version Show Version
74
73
  -h, --help Show this.
@@ -114,7 +113,7 @@ inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-
114
113
  - [Kevin Scaldeferri](http://kevin.scaldeferri.com/blog/)
115
114
  - [Kpumuk](http://kpumuk.info/)
116
115
  - [Maksim Horbul](http://github.com/mhorbul)
117
- - [Pivotal Labs][http://pivotallabs.com]
116
+ - [Pivotal Labs](http://www.pivotallabs.com)
118
117
  - [Rohan Deshpande](http://github.com/rdeshpande)
119
118
  - [Tchandy](http://thiagopradi.net/)
120
119
  - [Terence Lee](http://hone.heroku.com/)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.6
1
+ 0.3.7
@@ -13,6 +13,7 @@ Options are:
13
13
  BANNER
14
14
  opts.on("-n [PROCESSES]", Integer, "How many processes to use, default: available CPUs"){|n| options[:count] = n }
15
15
  opts.on("-p", '--path [PATH]', "run tests inside this path only"){|path| options[:path_prefix] = path }
16
+ opts.on("--no-sort", "do not sort files before running them"){ |no_sort| options[:no_sort] = no_sort }
16
17
  opts.on("-m [FLOAT]", "--multiply-processes [FLOAT]", Float, "use given number as a multiplier of processes to run"){ |multiply| options[:multiply] = multiply }
17
18
  opts.on("-r", '--root [PATH]', "execute test commands from this path"){|path| options[:root] = path }
18
19
  opts.on("-e", '--exec [COMMAND]', "execute this code parallel and with ENV['TEST_ENV_NUM']"){|path| options[:execute] = path }
@@ -22,7 +23,6 @@ BANNER
22
23
  opts.on("-h", "--help", "Show this.") { puts opts; exit }
23
24
  end.parse!
24
25
 
25
-
26
26
  # get files to run from arguments
27
27
  options[:files] = ARGV if ARGV.size > 0
28
28
 
@@ -50,7 +50,7 @@ else
50
50
  tests_folder = File.join(task, options[:path_prefix].to_s)
51
51
  tests_folder = File.join(options[:root], tests_folder) unless options[:root].to_s.empty?
52
52
 
53
- groups = klass.tests_in_groups(options[:files] || tests_folder, num_processes)
53
+ groups = klass.tests_in_groups(options[:files] || tests_folder, num_processes, :no_sort => options[:no_sort])
54
54
  num_processes = groups.size
55
55
 
56
56
  #adjust processes to groups
@@ -18,8 +18,9 @@ class ParallelTests
18
18
  end
19
19
 
20
20
  # finds all tests and partitions them into groups
21
- def self.tests_in_groups(root, num)
22
- tests_with_sizes = slow_specs_first(find_tests_with_sizes(root))
21
+ def self.tests_in_groups(root, num, options={})
22
+ tests_with_sizes = find_tests_with_sizes(root)
23
+ tests_with_sizes = slow_specs_first(tests_with_sizes) unless options[:no_sort]
23
24
 
24
25
  # always add to smallest group
25
26
  groups = Array.new(num){{:tests => [], :size => 0}}
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{parallel_tests}
8
- s.version = "0.3.6"
8
+ s.version = "0.3.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
12
- s.date = %q{2010-05-03}
12
+ s.date = %q{2010-05-15}
13
13
  s.email = %q{grosser.michael@gmail.com}
14
14
  s.executables = ["parallel_spec", "parallel_cucumber", "parallel_test"]
15
15
  s.extra_rdoc_files = [
@@ -91,4 +91,11 @@ describe 'CLI' do
91
91
  result.should include('333')
92
92
  result.should_not include('222')
93
93
  end
94
- end
94
+
95
+ it "can run with test-options" do
96
+ write "x1_spec.rb", ""
97
+ write "x2_spec.rb", ""
98
+ result = run_specs(:add => "--test-options ' --version'", :processes => 2)
99
+ result.should =~ /^rspec [\d\.]+\nrspec [\d\.]+$/m # prints version twice
100
+ end
101
+ end
@@ -49,6 +49,25 @@ describe ParallelTests do
49
49
  end
50
50
  end
51
51
 
52
+ describe :test_in_groups do
53
+ it "does not sort when passed false do_sort option" do
54
+ ParallelTests.should_not_receive(:slow_specs_first)
55
+ ParallelTests.tests_in_groups [], 1, :no_sort => true
56
+ end
57
+
58
+ it "does sort when not passed do_sort option" do
59
+ ParallelTests.stub!(:find_tests_with_sizes).and_return([])
60
+ ParallelTests.should_receive(:slow_specs_first).and_return([])
61
+ ParallelTests.tests_in_groups [], 1
62
+ end
63
+
64
+ it "does sort when not passed true do_sort option" do
65
+ ParallelTests.stub!(:find_tests_with_sizes).and_return([])
66
+ ParallelTests.should_receive(:slow_specs_first).and_return([])
67
+ ParallelTests.tests_in_groups [], 1
68
+ end
69
+ end
70
+
52
71
  describe :find_results do
53
72
  it "finds multiple results in test output" do
54
73
  output = <<EOF
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 6
9
- version: 0.3.6
8
+ - 7
9
+ version: 0.3.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Grosser
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-03 00:00:00 +02:00
17
+ date: 2010-05-15 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency