parallel_tests 0.11.5 → 0.11.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -0
- data/Gemfile.lock +5 -1
- data/Readme.md +1 -1
- data/lib/parallel_tests.rb +7 -3
- data/lib/parallel_tests/cli.rb +2 -1
- data/lib/parallel_tests/test/runner.rb +10 -2
- data/lib/parallel_tests/version.rb +1 -1
- data/spec/integration_spec.rb +2 -0
- data/spec/parallel_tests/test/runner_spec.rb +3 -0
- data/spec/parallel_tests_spec.rb +12 -2
- metadata +4 -4
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
parallel_tests (0.11.
|
4
|
+
parallel_tests (0.11.6)
|
5
5
|
parallel
|
6
6
|
|
7
7
|
GEM
|
@@ -18,7 +18,10 @@ GEM
|
|
18
18
|
diff-lcs (1.1.3)
|
19
19
|
gherkin (2.7.6)
|
20
20
|
json (>= 1.4.6)
|
21
|
+
gherkin (2.7.6-java)
|
22
|
+
json (>= 1.4.6)
|
21
23
|
json (1.7.5)
|
24
|
+
json (1.7.5-java)
|
22
25
|
parallel (0.6.4)
|
23
26
|
rake (10.0.3)
|
24
27
|
rspec (2.12.0)
|
@@ -33,6 +36,7 @@ GEM
|
|
33
36
|
test-unit (2.4.4)
|
34
37
|
|
35
38
|
PLATFORMS
|
39
|
+
java
|
36
40
|
ruby
|
37
41
|
|
38
42
|
DEPENDENCIES
|
data/Readme.md
CHANGED
@@ -231,7 +231,6 @@ TODO
|
|
231
231
|
- fix tests vs cucumber >= 1.2 `unknown option --format`
|
232
232
|
- add integration tests for the rake tasks, maybe generate a rails project ...
|
233
233
|
- add unit tests for cucumber runtime formatter
|
234
|
-
- make jRuby compatible [basics](http://yehudakatz.com/2009/07/01/new-rails-isolation-testing/)
|
235
234
|
- make windows compatible
|
236
235
|
|
237
236
|
Authors
|
@@ -285,6 +284,7 @@ inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-
|
|
285
284
|
- [Caleb Tomlinson](https://github.com/calebTomlinson)
|
286
285
|
- [Jawwad Ahmad](https://github.com/jawwad)
|
287
286
|
- [Iain Beeston](https://github.com/iainbeeston)
|
287
|
+
- [Alejandro Pulver](https://github.com/alepulver)
|
288
288
|
|
289
289
|
[Michael Grosser](http://grosser.it)<br/>
|
290
290
|
michael@grosser.it<br/>
|
data/lib/parallel_tests.rb
CHANGED
@@ -43,8 +43,12 @@ module ParallelTests
|
|
43
43
|
|
44
44
|
# Fun fact: this includes the current process if it's run via parallel_tests
|
45
45
|
def self.number_of_running_processes
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
if RUBY_ENGINE == "jruby"
|
47
|
+
Thread.list.count { |t| t[:running_parallel_test] }
|
48
|
+
else
|
49
|
+
result = `#{GREP_PROCESSES_COMMAND}`
|
50
|
+
raise "Could not grep for processes -> #{result}" if result.strip != "" && !$?.success?
|
51
|
+
result.split("\n").size
|
52
|
+
end
|
49
53
|
end
|
50
54
|
end
|
data/lib/parallel_tests/cli.rb
CHANGED
@@ -20,7 +20,8 @@ module ParallelTests
|
|
20
20
|
|
21
21
|
def execute_in_parallel(items, num_processes, options)
|
22
22
|
Tempfile.open 'parallel_tests-lock' do |lock|
|
23
|
-
|
23
|
+
mode = (RUBY_ENGINE == "jruby" ? :in_threads : :in_processes)
|
24
|
+
return Parallel.map(items, mode => num_processes) do |item|
|
24
25
|
result = yield(item)
|
25
26
|
report_output(result, lock) if options[:serialize_stdout]
|
26
27
|
result
|
@@ -64,8 +64,16 @@ module ParallelTests
|
|
64
64
|
cmd = "#{exports};#{cmd}"
|
65
65
|
|
66
66
|
output, errput, exitstatus = nil
|
67
|
-
|
68
|
-
|
67
|
+
if RUBY_ENGINE == "jruby"
|
68
|
+
Thread.current[:running_parallel_test] = true
|
69
|
+
# JRuby's popen3 doesn't pass arguments correctly to the shell, so we use stdin
|
70
|
+
Open3.popen3("sh -") do |stdin, stdout, stderr, thread|
|
71
|
+
stdin.puts cmd
|
72
|
+
stdin.close
|
73
|
+
output, errput = capture_output(stdout, stderr, silence)
|
74
|
+
end
|
75
|
+
exitstatus = $?.exitstatus
|
76
|
+
elsif RUBY_VERSION =~ /^1\.8/ or ENV["TEAMCITY_RAKE_RUNNER_MODE"] # fix #207
|
69
77
|
open("|#{cmd}", "r") do |output|
|
70
78
|
output, errput = capture_output(output, nil, silence)
|
71
79
|
end
|
data/spec/integration_spec.rb
CHANGED
@@ -139,6 +139,7 @@ describe 'CLI' do
|
|
139
139
|
end
|
140
140
|
|
141
141
|
it "runs faster with more processes" do
|
142
|
+
pending if RUBY_ENGINE == "jruby"
|
142
143
|
2.times{|i|
|
143
144
|
write "spec/xxx#{i}_spec.rb", 'describe("it"){it("should"){sleep 5}}; $stderr.puts ENV["TEST_ENV_NUMBER"]'
|
144
145
|
}
|
@@ -197,6 +198,7 @@ describe 'CLI' do
|
|
197
198
|
end
|
198
199
|
|
199
200
|
it "can wait_for_other_processes_to_finish" do
|
201
|
+
pending if RUBY_ENGINE == "jruby"
|
200
202
|
write "test/a_test.rb", "require 'parallel_tests'; sleep 0.5 ; ParallelTests.wait_for_other_processes_to_finish; puts 'a'"
|
201
203
|
write "test/b_test.rb", "sleep 1; puts 'b'"
|
202
204
|
write "test/c_test.rb", "sleep 1.5; puts 'c'"
|
@@ -60,6 +60,7 @@ describe ParallelTests::Test::Runner do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
it "groups by size and adds isolated separately" do
|
63
|
+
pending if RUBY_ENGINE == "jruby"
|
63
64
|
ParallelTests::Test::Runner.should_receive(:with_runtime_info).
|
64
65
|
and_return([
|
65
66
|
['aaa', 0],
|
@@ -173,6 +174,7 @@ EOF
|
|
173
174
|
end
|
174
175
|
|
175
176
|
it "finds test files but ignores those in symlinked folders" do
|
177
|
+
pending if RUBY_ENGINE == "jruby"
|
176
178
|
with_files(['a/a_test.rb','b/b_test.rb']) do |root|
|
177
179
|
`ln -s #{root}/a #{root}/b/link`
|
178
180
|
call(["#{root}/b"], :symlinks => false).sort.should == [
|
@@ -353,6 +355,7 @@ EOF
|
|
353
355
|
end
|
354
356
|
|
355
357
|
it "prints output while running" do
|
358
|
+
pending if RUBY_ENGINE == "jruby"
|
356
359
|
run_with_file("$stdout.sync = true; puts 123; sleep 0.1; print 345; sleep 0.1; puts 567") do |path|
|
357
360
|
$stdout.should_receive(:print).with("123\n")
|
358
361
|
if RUBY_VERSION =~ /^1\.8/
|
data/spec/parallel_tests_spec.rb
CHANGED
@@ -90,6 +90,7 @@ describe ParallelTests do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
it "waits for other processes to finish" do
|
93
|
+
pending if RUBY_ENGINE == "jruby"
|
93
94
|
ENV["TEST_ENV_NUMBER"] = "2"
|
94
95
|
counter = 0
|
95
96
|
ParallelTests.stub(:sleep).with{ sleep 0.1; counter += 1 }
|
@@ -107,8 +108,17 @@ describe ParallelTests do
|
|
107
108
|
|
108
109
|
it "is 2 when 2 are running" do
|
109
110
|
wait = 0.2
|
110
|
-
2.times
|
111
|
-
|
111
|
+
2.times do
|
112
|
+
Thread.new do
|
113
|
+
if RUBY_ENGINE == "jruby"
|
114
|
+
Thread.current[:running_parallel_test] = true
|
115
|
+
sleep wait
|
116
|
+
else
|
117
|
+
`TEST_ENV_NUMBER=1; sleep #{wait}`
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
sleep wait / 2
|
112
122
|
ParallelTests.number_of_running_processes.should == 2
|
113
123
|
sleep wait
|
114
124
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parallel_tests
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parallel
|
@@ -96,7 +96,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
96
|
version: '0'
|
97
97
|
segments:
|
98
98
|
- 0
|
99
|
-
hash:
|
99
|
+
hash: -3981454467502280658
|
100
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
101
|
none: false
|
102
102
|
requirements:
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
segments:
|
107
107
|
- 0
|
108
|
-
hash:
|
108
|
+
hash: -3981454467502280658
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
111
|
rubygems_version: 1.8.25
|