parallel_tests 0.6.2 → 0.6.3
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 +2 -0
- data/VERSION +1 -1
- data/lib/parallel_tests.rb +1 -1
- data/parallel_tests.gemspec +2 -2
- data/spec/integration_spec.rb +24 -18
- data/spec/parallel_tests_spec.rb +1 -1
- metadata +4 -4
data/Readme.md
CHANGED
@@ -181,6 +181,7 @@ TIPS
|
|
181
181
|
- [Capybara setup](https://github.com/grosser/parallel_tests/wiki)
|
182
182
|
- [Sphinx setup](https://github.com/grosser/parallel_tests/wiki)
|
183
183
|
- [SQL schema format] use :ruby schema format to get faster parallel:prepare`
|
184
|
+
- `export PARALLEL_TEST_PROCESSORS=X` in your environment and parallel_tests will use this number of processors by default
|
184
185
|
- with zsh this would be `rake "parallel:prepare[3]"`
|
185
186
|
|
186
187
|
TODO
|
@@ -214,6 +215,7 @@ inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-
|
|
214
215
|
- [Joe Yates](http://titusd.co.uk)
|
215
216
|
- [asmega](http://www.ph-lee.com)
|
216
217
|
- [Doug Barth](https://github.com/dougbarth)
|
218
|
+
- [Geoffrey Hichborn](https://github.com/phene)
|
217
219
|
|
218
220
|
[Michael Grosser](http://grosser.it)<br/>
|
219
221
|
michael@grosser.it<br/>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.3
|
data/lib/parallel_tests.rb
CHANGED
@@ -37,7 +37,7 @@ class ParallelTests
|
|
37
37
|
|
38
38
|
def self.run_tests(test_files, process_number, options)
|
39
39
|
require_list = test_files.map { |filename| "\"#{filename}\"" }.join(",")
|
40
|
-
cmd = "ruby -Itest
|
40
|
+
cmd = "ruby -Itest -e '[#{require_list}].each {|f| require f }' - #{options[:test_options]}"
|
41
41
|
execute_command(cmd, process_number, options)
|
42
42
|
end
|
43
43
|
|
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.3"
|
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-09-
|
12
|
+
s.date = %q{2011-09-26}
|
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
@@ -14,7 +14,7 @@ describe 'CLI' do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def write(file, content)
|
17
|
-
path = "#{folder}
|
17
|
+
path = "#{folder}/#{file}"
|
18
18
|
`mkdir -p #{File.dirname(path)}` unless File.exist?(File.dirname(path))
|
19
19
|
File.open(path, 'w'){|f| f.write content }
|
20
20
|
path
|
@@ -28,14 +28,14 @@ describe 'CLI' do
|
|
28
28
|
"#{bin_folder}/parallel_test"
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
32
|
-
`cd #{folder} && #{executable} --chunk-timeout 999 -t spec -n #{options[:processes]||2} #{options[:add]} 2>&1`
|
31
|
+
def run_tests(options={})
|
32
|
+
`cd #{folder} && #{executable} --chunk-timeout 999 -t #{options[:type] || 'spec'} -n #{options[:processes]||2} #{options[:add]} 2>&1`
|
33
33
|
end
|
34
34
|
|
35
35
|
it "runs tests in parallel" do
|
36
|
-
write 'xxx_spec.rb', 'describe("it"){it("should"){puts "TEST1"}}'
|
37
|
-
write 'xxx2_spec.rb', 'describe("it"){it("should"){puts "TEST2"}}'
|
38
|
-
result =
|
36
|
+
write 'spec/xxx_spec.rb', 'describe("it"){it("should"){puts "TEST1"}}'
|
37
|
+
write 'spec/xxx2_spec.rb', 'describe("it"){it("should"){puts "TEST2"}}'
|
38
|
+
result = run_tests
|
39
39
|
|
40
40
|
# test ran and gave their puts
|
41
41
|
result.should include('TEST1')
|
@@ -50,9 +50,9 @@ describe 'CLI' do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it "fails when tests fail" do
|
53
|
-
write 'xxx_spec.rb', 'describe("it"){it("should"){puts "TEST1"}}'
|
54
|
-
write 'xxx2_spec.rb', 'describe("it"){it("should"){1.should == 2}}'
|
55
|
-
result =
|
53
|
+
write 'spec/xxx_spec.rb', 'describe("it"){it("should"){puts "TEST1"}}'
|
54
|
+
write 'spec/xxx2_spec.rb', 'describe("it"){it("should"){1.should == 2}}'
|
55
|
+
result = run_tests
|
56
56
|
|
57
57
|
result.scan('1 example, 1 failure').size.should == 1
|
58
58
|
result.scan('1 example, 0 failure').size.should == 1
|
@@ -86,28 +86,34 @@ describe 'CLI' do
|
|
86
86
|
|
87
87
|
it "runs faster with more processes" do
|
88
88
|
2.times{|i|
|
89
|
-
write "xxx#{i}_spec.rb", 'describe("it"){it("should"){sleep 5}}; $stderr.puts ENV["TEST_ENV_NUMBER"]'
|
89
|
+
write "spec/xxx#{i}_spec.rb", 'describe("it"){it("should"){sleep 5}}; $stderr.puts ENV["TEST_ENV_NUMBER"]'
|
90
90
|
}
|
91
91
|
t = Time.now
|
92
|
-
puts
|
92
|
+
puts run_tests(:processes => 2)
|
93
93
|
expected = 10
|
94
94
|
(Time.now - t).should <= expected
|
95
95
|
end
|
96
96
|
|
97
97
|
it "can can with given files" do
|
98
|
-
write "x1_spec.rb", "puts '111'"
|
99
|
-
write "x2_spec.rb", "puts '222'"
|
100
|
-
write "x3_spec.rb", "puts '333'"
|
101
|
-
result =
|
98
|
+
write "spec/x1_spec.rb", "puts '111'"
|
99
|
+
write "spec/x2_spec.rb", "puts '222'"
|
100
|
+
write "spec/x3_spec.rb", "puts '333'"
|
101
|
+
result = run_tests(:add => 'spec/x1_spec.rb spec/x3_spec.rb')
|
102
102
|
result.should include('111')
|
103
103
|
result.should include('333')
|
104
104
|
result.should_not include('222')
|
105
105
|
end
|
106
106
|
|
107
107
|
it "can run with test-options" do
|
108
|
-
write "x1_spec.rb", ""
|
109
|
-
write "x2_spec.rb", ""
|
110
|
-
result =
|
108
|
+
write "spec/x1_spec.rb", ""
|
109
|
+
write "spec/x2_spec.rb", ""
|
110
|
+
result = run_tests(:add => "--test-options ' --version'", :processes => 2)
|
111
111
|
result.should =~ /\d+\.\d+\.\d+.*\d+\.\d+\.\d+/m # prints version twice
|
112
112
|
end
|
113
|
+
|
114
|
+
it "passes test options to test::unit" do
|
115
|
+
write "test/x1_test.rb", "require 'test/unit'; class XTest < Test::Unit::TestCase; def test_xxx; end; end"
|
116
|
+
result = run_tests(:type => :test, :add => '--test-options "-v"')
|
117
|
+
result.should include('test_xxx(XTest)') # verbose output of every test
|
118
|
+
end
|
113
119
|
end
|
data/spec/parallel_tests_spec.rb
CHANGED
@@ -48,7 +48,7 @@ describe ParallelTests do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "uses options" do
|
51
|
-
ParallelTests.should_receive(:open).with{|x,y| x=~ %r{ruby -Itest -v}}.and_return mocked_process
|
51
|
+
ParallelTests.should_receive(:open).with{|x,y| x=~ %r{ruby -Itest .* - -v}}.and_return mocked_process
|
52
52
|
ParallelTests.run_tests(['xxx'],1,:test_options => '-v')
|
53
53
|
end
|
54
54
|
|
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: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 3
|
10
|
+
version: 0.6.3
|
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-09-
|
18
|
+
date: 2011-09-26 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|