parallel_tests 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml CHANGED
@@ -5,3 +5,6 @@ rvm:
5
5
  - 2.1.0
6
6
  - jruby-1.7.6
7
7
  - jruby-head
8
+ matrix:
9
+ allow_failures:
10
+ - rvm: jruby-head
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- parallel_tests (1.0.5)
4
+ parallel_tests (1.0.6)
5
5
  parallel
6
6
 
7
7
  GEM
data/Readme.md CHANGED
@@ -184,7 +184,7 @@ Options are:
184
184
  --no-symlinks Do not traverse symbolic links to find test files
185
185
  --ignore-tags [PATTERN] When counting steps ignore scenarios with tags that match this pattern
186
186
  --nice execute test commands with low priority.
187
- --only-group [INTEGER] Group the files, but only run the group specified here. Requires group-by filesize (will be set automatically if group-by is blank and only-group is specified)
187
+ --only-group INT[, INT] Group the files, but only run the group(s) specified here. Requires group-by filesize (will be set automatically if group-by is blank and only-group is specified)
188
188
  -v, --version Show Version
189
189
  -h, --help Show this.
190
190
 
@@ -36,9 +36,11 @@ module ParallelTests
36
36
  groups = @runner.tests_in_groups(options[:files], num_processes, options)
37
37
 
38
38
  test_results = if options[:only_group]
39
- group_to_run = groups[options[:only_group] - 1]
40
-
41
- [run_tests(group_to_run, 0, num_processes, options)]
39
+ groups_to_run = options[:only_group].collect{|i| groups[i - 1]}
40
+ report_number_of_tests(groups_to_run)
41
+ execute_in_parallel(groups_to_run, groups_to_run.size, options) do |group|
42
+ run_tests(group, groups_to_run.index(group), 1, options)
43
+ end
42
44
  else
43
45
  report_number_of_tests(groups)
44
46
 
@@ -124,7 +126,7 @@ TEXT
124
126
  options[:isolate] = true
125
127
  end
126
128
 
127
- opts.on("--only-group [INTEGER]", Integer) { |group| options[:only_group] = group }
129
+ opts.on("--only-group INT[, INT]", Array) { |groups| options[:only_group] = groups.map(&:to_i) }
128
130
 
129
131
  opts.on("-e", "--exec [COMMAND]", "execute this code parallel and with ENV['TEST_ENV_NUM']") { |path| options[:execute] = path }
130
132
  opts.on("-o", "--test-options '[OPTIONS]'", "execute test commands with those options") { |arg| options[:test_options] = arg }
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '1.0.5'
2
+ VERSION = Version = '1.0.6'
3
3
  end
@@ -33,6 +33,30 @@ describe ParallelTests::CLI do
33
33
  it "parses nice as nice" do
34
34
  call(["--nice"]).should == defaults.merge(:nice => true)
35
35
  end
36
+
37
+ context "parse only-group" do
38
+ it "group_by should be set to filesize" do
39
+ call(["--only-group", '1']).should == defaults.merge(:group_by=>:filesize, :only_group => [1])
40
+ end
41
+
42
+ it "raise error when group_by isn't filesize" do
43
+ expect{
44
+ call(["--only-group", '1', '--group-by', 'steps'])
45
+ }.to raise_error(RuntimeError)
46
+ end
47
+
48
+ context "with group_by default to filesize" do
49
+ let(:defaults_with_filesize){defaults.merge(:group_by => :filesize)}
50
+
51
+ it "with multiple groups" do
52
+ call(["--only-group", '4,5']).should == defaults_with_filesize.merge(:only_group => [4,5])
53
+ end
54
+
55
+ it "with a single group" do
56
+ call(["--only-group", '4']).should == defaults_with_filesize.merge(:only_group => [4])
57
+ end
58
+ end
59
+ end
36
60
  end
37
61
 
38
62
  describe "#load_runner" do
@@ -73,6 +97,45 @@ describe ParallelTests::CLI do
73
97
  subject.send(:final_fail_message).should == "\e[31mTests Failed\e[0m"
74
98
  end
75
99
  end
100
+
101
+ describe "#run_tests_in_parallel" do
102
+ context "specific groups to run" do
103
+ let(:results){ {:stdout => "", :exit_status => 0} }
104
+ before do
105
+ subject.should_receive(:load_runner).with("my_test_runner").and_return(ParallelTests::MyTestRunner::Runner)
106
+ ParallelTests::MyTestRunner::Runner.stub(:test_file_name).and_return("test")
107
+ ParallelTests::MyTestRunner::Runner.should_receive(:tests_in_groups).and_return([
108
+ ['aaa','bbb'],
109
+ ['ccc', 'ddd'],
110
+ ['eee', 'fff']
111
+ ])
112
+ subject.should_receive(:report_results).and_return(nil)
113
+ end
114
+
115
+ it "calls run_tests once when one group specified" do
116
+ subject.should_receive(:run_tests).once.and_return(results)
117
+ subject.run(['-n', '3', '--only-group', '1', '-t', 'my_test_runner'])
118
+ end
119
+
120
+ it "calls run_tests twice when two groups are specified" do
121
+ subject.should_receive(:run_tests).twice.and_return(results)
122
+ subject.run(['-n', '3', '--only-group', '1,2', '-t', 'my_test_runner'])
123
+ end
124
+
125
+ it "run only one group specified" do
126
+ options = {:count=>3, :only_group=>[2], :files=>[], :group_by=>:filesize}
127
+ subject.should_receive(:run_tests).once.with(['ccc', 'ddd'], 0, 1, options).and_return(results)
128
+ subject.run(['-n', '3', '--only-group', '2', '-t', 'my_test_runner'])
129
+ end
130
+
131
+ it "run twice with multiple groups" do
132
+ options = {:count=>3, :only_group=>[2,3], :files=>[], :group_by=>:filesize}
133
+ subject.should_receive(:run_tests).once.ordered.with(['ccc', 'ddd'], 0, 1, options).and_return(results)
134
+ subject.should_receive(:run_tests).once.ordered.with(['eee', 'fff'], 1, 1, options).and_return(results)
135
+ subject.run(['-n', '3', '--only-group', '2,3', '-t', 'my_test_runner'])
136
+ end
137
+ end
138
+ end
76
139
  end
77
140
 
78
141
 
@@ -192,7 +192,8 @@ EOF
192
192
  test_files = %w(features/a.rb:23 features/a.rb:44 features/b.rb:12)
193
193
 
194
194
  ParallelTests::Test::Runner.should_receive(:execute_command).with do |a,b,c,d|
195
- a =~ Regexp.new('features/a.rb:23:44 features/b.rb:12')
195
+ argv = a.split("--").last.split(" ")[2..-1].sort
196
+ argv == ["features/a.rb:23:44", "features/b.rb:12"]
196
197
  end
197
198
 
198
199
  call(test_files, 1, 2, { :group_by => :scenarios })
metadata CHANGED
@@ -1,42 +1,51 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: parallel_tests
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.5
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 6
10
+ version: 1.0.6
5
11
  platform: ruby
6
- authors:
12
+ authors:
7
13
  - Michael Grosser
8
14
  autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
- date: 2014-08-19 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2014-08-21 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ prerelease: false
14
22
  name: parallel
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
23
  type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
24
27
  - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ requirement: *id001
27
34
  description:
28
35
  email: michael@grosser.it
29
- executables:
36
+ executables:
30
37
  - parallel_spinach
31
38
  - parallel_cucumber
32
39
  - parallel_rspec
33
40
  - parallel_test
34
41
  extensions: []
42
+
35
43
  extra_rdoc_files: []
36
- files:
37
- - ".gitignore"
38
- - ".rspec"
39
- - ".travis.yml"
44
+
45
+ files:
46
+ - .gitignore
47
+ - .rspec
48
+ - .travis.yml
40
49
  - Gemfile
41
50
  - Gemfile.lock
42
51
  - Rakefile
@@ -88,27 +97,37 @@ files:
88
97
  - spec/parallel_tests_spec.rb
89
98
  - spec/spec_helper.rb
90
99
  homepage: http://github.com/grosser/parallel_tests
91
- licenses:
100
+ licenses:
92
101
  - MIT
93
- metadata: {}
94
102
  post_install_message:
95
103
  rdoc_options: []
96
- require_paths:
104
+
105
+ require_paths:
97
106
  - lib
98
- required_ruby_version: !ruby/object:Gem::Requirement
99
- requirements:
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
100
110
  - - ">="
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
- required_rubygems_version: !ruby/object:Gem::Requirement
104
- requirements:
111
+ - !ruby/object:Gem::Version
112
+ hash: 3
113
+ segments:
114
+ - 0
115
+ version: "0"
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ none: false
118
+ requirements:
105
119
  - - ">="
106
- - !ruby/object:Gem::Version
107
- version: '0'
120
+ - !ruby/object:Gem::Version
121
+ hash: 3
122
+ segments:
123
+ - 0
124
+ version: "0"
108
125
  requirements: []
126
+
109
127
  rubyforge_project:
110
- rubygems_version: 2.2.2
128
+ rubygems_version: 1.8.15
111
129
  signing_key:
112
- specification_version: 4
130
+ specification_version: 3
113
131
  summary: Run Test::Unit / RSpec / Cucumber / Spinach in parallel
114
132
  test_files: []
133
+
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 95fdce8bba80efd898bd2be638c7d8ac3ed01e50
4
- data.tar.gz: c7070894cfb9c0b4befaedb42d9e91d45a578eca
5
- SHA512:
6
- metadata.gz: f818a67bc31e2cac2daa2f3621c1c0c10cf58a23e1228a124b43af356d5025db24a231c73a456e0178cdd31939ca7cead04d698630a29f20e8ab82941de0b4ec
7
- data.tar.gz: dd574fc4717185181ba2c213d5af4683b97a88a7df7bc326201131e954d9d8da555eb6cf7b30af3310f6cdd4bbcaebe464076895443394ecd3e9acbc92ffd0d7