parallel_tests 0.6.0 → 0.6.1
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/Readme.md +1 -0
- data/VERSION +1 -1
- data/bin/parallel_test +1 -2
- data/lib/parallel_tests.rb +10 -0
- data/parallel_tests.gemspec +2 -2
- data/spec/integration_spec.rb +6 -4
- data/spec/parallel_cucumber_spec.rb +7 -7
- data/spec/parallel_specs_spec.rb +17 -17
- data/spec/parallel_tests_spec.rb +26 -4
- metadata +4 -4
data/Readme.md
CHANGED
@@ -210,6 +210,7 @@ inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-
|
|
210
210
|
- [Michael Kintzer](https://github.com/rockrep)
|
211
211
|
- [nathansobo](https://github.com/nathansobo)
|
212
212
|
- [Joe Yates](http://titusd.co.uk)
|
213
|
+
- [asmega](http://www.ph-lee.com)
|
213
214
|
|
214
215
|
[Michael Grosser](http://grosser.it)<br/>
|
215
216
|
michael@grosser.it<br/>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.1
|
data/bin/parallel_test
CHANGED
data/lib/parallel_tests.rb
CHANGED
@@ -63,6 +63,16 @@ class ParallelTests
|
|
63
63
|
'__foo__'
|
64
64
|
end
|
65
65
|
|
66
|
+
def self.summarize_results(results)
|
67
|
+
results = results.join(' ').gsub(/s\b/,'') # combine and singularize results
|
68
|
+
counts = results.scan(/(\d+) (\w+)/)
|
69
|
+
sums = counts.inject(Hash.new(0)) do |sum, (number, word)|
|
70
|
+
sum[word] += number.to_i
|
71
|
+
sum
|
72
|
+
end
|
73
|
+
sums.sort.map{|word, number| "#{number} #{word}#{'s' if number != 1}" }.join(', ')
|
74
|
+
end
|
75
|
+
|
66
76
|
protected
|
67
77
|
|
68
78
|
# read output of the process and print in in chucks
|
data/parallel_tests.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{parallel_tests}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.1"
|
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{2011-08-
|
12
|
+
s.date = %q{2011-08-14}
|
13
13
|
s.email = %q{grosser.michael@gmail.com}
|
14
14
|
s.executables = ["parallel_cucumber", "parallel_test", "parallel_spec"]
|
15
15
|
s.files = [
|
data/spec/integration_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe 'CLI' do
|
4
4
|
before do
|
@@ -42,7 +42,8 @@ describe 'CLI' do
|
|
42
42
|
result.should include('TEST2')
|
43
43
|
|
44
44
|
# all results present
|
45
|
-
result.scan('1 example, 0 failure').size.should ==
|
45
|
+
result.scan('1 example, 0 failure').size.should == 2 # 2 results
|
46
|
+
result.scan('2 examples, 0 failures').size.should == 1 # 1 summary
|
46
47
|
result.scan(/Finished in \d+\.\d+ seconds/).size.should == 2
|
47
48
|
result.scan(/Took \d+\.\d+ seconds/).size.should == 1 # parallel summary
|
48
49
|
$?.success?.should == true
|
@@ -53,8 +54,9 @@ describe 'CLI' do
|
|
53
54
|
write 'xxx2_spec.rb', 'describe("it"){it("should"){1.should == 2}}'
|
54
55
|
result = run_specs
|
55
56
|
|
56
|
-
result.scan('1 example, 1 failure').size.should ==
|
57
|
-
result.scan('1 example, 0 failure').size.should ==
|
57
|
+
result.scan('1 example, 1 failure').size.should == 1
|
58
|
+
result.scan('1 example, 0 failure').size.should == 1
|
59
|
+
result.scan('2 examples, 1 failure').size.should == 1
|
58
60
|
$?.success?.should == false
|
59
61
|
end
|
60
62
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ParallelCucumber do
|
4
4
|
test_tests_in_groups(ParallelCucumber, 'features', ".feature")
|
@@ -12,36 +12,36 @@ describe ParallelCucumber do
|
|
12
12
|
|
13
13
|
it "uses TEST_ENV_NUMBER=blank when called for process 0" do
|
14
14
|
ParallelCucumber.should_receive(:open).with{|x,y| x=~/TEST_ENV_NUMBER= /}.and_return mocked_process
|
15
|
-
ParallelCucumber.run_tests(['xxx'],0,
|
15
|
+
ParallelCucumber.run_tests(['xxx'],0,{})
|
16
16
|
end
|
17
17
|
|
18
18
|
it "uses TEST_ENV_NUMBER=2 when called for process 1" do
|
19
19
|
ParallelCucumber.should_receive(:open).with{|x,y| x=~/TEST_ENV_NUMBER=2/}.and_return mocked_process
|
20
|
-
ParallelCucumber.run_tests(['xxx'],1,
|
20
|
+
ParallelCucumber.run_tests(['xxx'],1,{})
|
21
21
|
end
|
22
22
|
|
23
23
|
it "returns the output" do
|
24
24
|
io = open('spec/spec_helper.rb')
|
25
25
|
ParallelCucumber.stub!(:print)
|
26
26
|
ParallelCucumber.should_receive(:open).and_return io
|
27
|
-
ParallelCucumber.run_tests(['xxx'],1,
|
27
|
+
ParallelCucumber.run_tests(['xxx'],1,{})[:stdout].should =~ /\$LOAD_PATH << File/
|
28
28
|
end
|
29
29
|
|
30
30
|
it "runs bundle exec cucumber when on bundler 0.9" do
|
31
31
|
ParallelCucumber.stub!(:bundler_enabled?).and_return true
|
32
32
|
ParallelCucumber.should_receive(:open).with{|x,y| x =~ %r{bundle exec cucumber}}.and_return mocked_process
|
33
|
-
ParallelCucumber.run_tests(['xxx'],1,
|
33
|
+
ParallelCucumber.run_tests(['xxx'],1,{})
|
34
34
|
end
|
35
35
|
|
36
36
|
it "runs script/cucumber when script/cucumber is found" do
|
37
37
|
ParallelCucumber.should_receive(:open).with{|x,y| x =~ %r{script/cucumber}}.and_return mocked_process
|
38
|
-
ParallelCucumber.run_tests(['xxx'],1,
|
38
|
+
ParallelCucumber.run_tests(['xxx'],1,{})
|
39
39
|
end
|
40
40
|
|
41
41
|
it "runs cucumber by default" do
|
42
42
|
File.stub!(:file?).with('script/cucumber').and_return false
|
43
43
|
ParallelCucumber.should_receive(:open).with{|x,y| x !~ %r{(script/cucumber)|(bundle exec cucumber)}}.and_return mocked_process
|
44
|
-
ParallelCucumber.run_tests(['xxx'],1,
|
44
|
+
ParallelCucumber.run_tests(['xxx'],1,{})
|
45
45
|
end
|
46
46
|
|
47
47
|
it "uses options passed in" do
|
data/spec/parallel_specs_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
require 'parallel_specs/spec_runtime_logger'
|
3
3
|
require 'parallel_specs/spec_summary_logger'
|
4
4
|
require 'parallel_specs/spec_failures_logger'
|
@@ -16,38 +16,38 @@ describe ParallelSpecs do
|
|
16
16
|
|
17
17
|
it "uses TEST_ENV_NUMBER=blank when called for process 0" do
|
18
18
|
ParallelSpecs.should_receive(:open).with{|x,y|x=~/TEST_ENV_NUMBER= /}.and_return mocked_process
|
19
|
-
ParallelSpecs.run_tests(['xxx'],0,
|
19
|
+
ParallelSpecs.run_tests(['xxx'],0,{})
|
20
20
|
end
|
21
21
|
|
22
22
|
it "uses TEST_ENV_NUMBER=2 when called for process 1" do
|
23
23
|
ParallelSpecs.should_receive(:open).with{|x,y| x=~/TEST_ENV_NUMBER=2/}.and_return mocked_process
|
24
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
24
|
+
ParallelSpecs.run_tests(['xxx'],1,{})
|
25
25
|
end
|
26
26
|
|
27
27
|
it "runs with color when called from cmdline" do
|
28
28
|
ParallelSpecs.should_receive(:open).with{|x,y| x=~/ --tty /}.and_return mocked_process
|
29
29
|
$stdout.should_receive(:tty?).and_return true
|
30
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
30
|
+
ParallelSpecs.run_tests(['xxx'],1,{})
|
31
31
|
end
|
32
32
|
|
33
33
|
it "runs without color when not called from cmdline" do
|
34
34
|
ParallelSpecs.should_receive(:open).with{|x,y| x !~ / --tty /}.and_return mocked_process
|
35
35
|
$stdout.should_receive(:tty?).and_return false
|
36
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
36
|
+
ParallelSpecs.run_tests(['xxx'],1,{})
|
37
37
|
end
|
38
38
|
|
39
39
|
it "runs with color for rspec 1 when called for the cmdline" do
|
40
40
|
File.should_receive(:file?).with('script/spec').and_return true
|
41
41
|
ParallelSpecs.should_receive(:open).with{|x,y| x=~/ RSPEC_COLOR=1 /}.and_return mocked_process
|
42
42
|
$stdout.should_receive(:tty?).and_return true
|
43
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
43
|
+
ParallelSpecs.run_tests(['xxx'],1,{})
|
44
44
|
end
|
45
45
|
|
46
46
|
it "runs without color for rspec 1 when not called for the cmdline" do
|
47
47
|
File.should_receive(:file?).with('script/spec').and_return true
|
48
48
|
ParallelSpecs.should_receive(:open).with{|x,y| x !~ / RSPEC_COLOR=1 /}.and_return mocked_process
|
49
49
|
$stdout.should_receive(:tty?).and_return false
|
50
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
50
|
+
ParallelSpecs.run_tests(['xxx'],1,{})
|
51
51
|
end
|
52
52
|
|
53
53
|
it "run bundle exec spec when on bundler rspec 1" do
|
@@ -55,7 +55,7 @@ describe ParallelSpecs do
|
|
55
55
|
ParallelSpecs.stub!(:bundler_enabled?).and_return true
|
56
56
|
ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-1.0.2"
|
57
57
|
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{bundle exec spec}}.and_return mocked_process
|
58
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
58
|
+
ParallelSpecs.run_tests(['xxx'],1,{})
|
59
59
|
end
|
60
60
|
|
61
61
|
it "run bundle exec rspec when on bundler rspec 2" do
|
@@ -63,39 +63,39 @@ describe ParallelSpecs do
|
|
63
63
|
ParallelSpecs.stub!(:bundler_enabled?).and_return true
|
64
64
|
ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-2.0.2"
|
65
65
|
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{bundle exec rspec}}.and_return mocked_process
|
66
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
66
|
+
ParallelSpecs.run_tests(['xxx'],1,{})
|
67
67
|
end
|
68
68
|
|
69
69
|
it "runs script/spec when script/spec can be found" do
|
70
70
|
File.should_receive(:file?).with('script/spec').and_return true
|
71
71
|
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{script/spec}}.and_return mocked_process
|
72
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
72
|
+
ParallelSpecs.run_tests(['xxx'],1,{})
|
73
73
|
end
|
74
74
|
|
75
75
|
it "runs spec when script/spec cannot be found" do
|
76
76
|
File.stub!(:file?).with('script/spec').and_return false
|
77
77
|
ParallelSpecs.should_receive(:open).with{|x,y| x !~ %r{script/spec}}.and_return mocked_process
|
78
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
78
|
+
ParallelSpecs.run_tests(['xxx'],1,{})
|
79
79
|
end
|
80
80
|
|
81
81
|
it "uses no -O when no opts where found" do
|
82
82
|
File.stub!(:file?).with('spec/spec.opts').and_return false
|
83
83
|
ParallelSpecs.should_receive(:open).with{|x,y| x !~ %r{spec/spec.opts}}.and_return mocked_process
|
84
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
84
|
+
ParallelSpecs.run_tests(['xxx'],1,{})
|
85
85
|
end
|
86
86
|
|
87
87
|
it "uses -O spec/spec.opts when found (with script/spec)" do
|
88
88
|
File.stub!(:file?).with('script/spec').and_return true
|
89
89
|
File.stub!(:file?).with('spec/spec.opts').and_return true
|
90
90
|
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{script/spec\s+ -O spec/spec.opts}}.and_return mocked_process
|
91
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
91
|
+
ParallelSpecs.run_tests(['xxx'],1,{})
|
92
92
|
end
|
93
93
|
|
94
94
|
it "uses -O spec/parallel_spec.opts when found (with script/spec)" do
|
95
95
|
File.stub!(:file?).with('script/spec').and_return true
|
96
96
|
File.should_receive(:file?).with('spec/parallel_spec.opts').and_return true
|
97
97
|
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{script/spec\s+ -O spec/parallel_spec.opts}}.and_return mocked_process
|
98
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
98
|
+
ParallelSpecs.run_tests(['xxx'],1,{})
|
99
99
|
end
|
100
100
|
|
101
101
|
it "uses -O spec/parallel_spec.opts with rspec1" do
|
@@ -105,7 +105,7 @@ describe ParallelSpecs do
|
|
105
105
|
ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-1.0.2"
|
106
106
|
|
107
107
|
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{spec\s+ -O spec/parallel_spec.opts}}.and_return mocked_process
|
108
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
108
|
+
ParallelSpecs.run_tests(['xxx'],1,{})
|
109
109
|
end
|
110
110
|
|
111
111
|
it "uses -O spec/parallel_spec.opts with rspec2" do
|
@@ -115,7 +115,7 @@ describe ParallelSpecs do
|
|
115
115
|
ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-2.4.2"
|
116
116
|
|
117
117
|
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{rspec\s+ --color --tty -O spec/parallel_spec.opts}}.and_return mocked_process
|
118
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
118
|
+
ParallelSpecs.run_tests(['xxx'],1,{})
|
119
119
|
end
|
120
120
|
|
121
121
|
it "uses options passed in" do
|
@@ -127,7 +127,7 @@ describe ParallelSpecs do
|
|
127
127
|
io = open('spec/spec_helper.rb')
|
128
128
|
ParallelSpecs.stub!(:print)
|
129
129
|
ParallelSpecs.should_receive(:open).and_return io
|
130
|
-
ParallelSpecs.run_tests(['xxx'],1,
|
130
|
+
ParallelSpecs.run_tests(['xxx'],1,{})[:stdout].should =~ /\$LOAD_PATH << File/
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
data/spec/parallel_tests_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ParallelTests do
|
4
4
|
test_tests_in_groups(ParallelTests, 'test', '_test.rb')
|
@@ -28,12 +28,12 @@ describe ParallelTests do
|
|
28
28
|
describe :run_tests do
|
29
29
|
it "uses TEST_ENV_NUMBER=blank when called for process 0" do
|
30
30
|
ParallelTests.should_receive(:open).with{|x,y|x=~/TEST_ENV_NUMBER= /}.and_return mocked_process
|
31
|
-
ParallelTests.run_tests(['xxx'],0,
|
31
|
+
ParallelTests.run_tests(['xxx'],0,{})
|
32
32
|
end
|
33
33
|
|
34
34
|
it "uses TEST_ENV_NUMBER=2 when called for process 1" do
|
35
35
|
ParallelTests.should_receive(:open).with{|x,y| x=~/TEST_ENV_NUMBER=2/}.and_return mocked_process
|
36
|
-
ParallelTests.run_tests(['xxx'],1,
|
36
|
+
ParallelTests.run_tests(['xxx'],1,{})
|
37
37
|
end
|
38
38
|
|
39
39
|
it "uses options" do
|
@@ -45,7 +45,7 @@ describe ParallelTests do
|
|
45
45
|
io = open('spec/spec_helper.rb')
|
46
46
|
ParallelTests.stub!(:print)
|
47
47
|
ParallelTests.should_receive(:open).and_return io
|
48
|
-
ParallelTests.run_tests(['xxx'],1,
|
48
|
+
ParallelTests.run_tests(['xxx'],1,{})[:stdout].should =~ /\$LOAD_PATH << File/
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -184,6 +184,28 @@ EOF
|
|
184
184
|
end
|
185
185
|
end
|
186
186
|
|
187
|
+
describe :summarize_results do
|
188
|
+
it "adds results" do
|
189
|
+
ParallelTests.summarize_results(['1 foo 3 bar','2 foo 5 bar']).should == '8 bars, 3 foos'
|
190
|
+
end
|
191
|
+
|
192
|
+
it "adds results with braces" do
|
193
|
+
ParallelTests.summarize_results(['1 foo(s) 3 bar(s)','2 foo 5 bar']).should == '8 bars, 3 foos'
|
194
|
+
end
|
195
|
+
|
196
|
+
it "adds same results with plurals" do
|
197
|
+
ParallelTests.summarize_results(['1 foo 3 bar','2 foos 5 bar']).should == '8 bars, 3 foos'
|
198
|
+
end
|
199
|
+
|
200
|
+
it "adds non-similar results" do
|
201
|
+
ParallelTests.summarize_results(['1 xxx 2 yyy','1 xxx 2 zzz']).should == '2 xxxs, 2 yyys, 2 zzzs'
|
202
|
+
end
|
203
|
+
|
204
|
+
it "does not pluralize 1" do
|
205
|
+
ParallelTests.summarize_results(['1 xxx 2 yyy']).should == '1 xxx, 2 yyys'
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
187
209
|
it "has a version" do
|
188
210
|
ParallelTests::VERSION.should =~ /^\d+\.\d+\.\d+$/
|
189
211
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 1
|
10
|
+
version: 0.6.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Grosser
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-08-
|
18
|
+
date: 2011-08-14 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|