parallel_tests 0.11.6 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/parallel_tests.rb +3 -7
- data/lib/parallel_tests/cli.rb +1 -2
- data/lib/parallel_tests/test/runner.rb +2 -2
- data/lib/parallel_tests/version.rb +1 -1
- data/spec/integration_spec.rb +2 -2
- data/spec/parallel_tests_spec.rb +1 -10
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/lib/parallel_tests.rb
CHANGED
@@ -43,12 +43,8 @@ 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
|
-
|
49
|
-
result = `#{GREP_PROCESSES_COMMAND}`
|
50
|
-
raise "Could not grep for processes -> #{result}" if result.strip != "" && !$?.success?
|
51
|
-
result.split("\n").size
|
52
|
-
end
|
46
|
+
result = `#{GREP_PROCESSES_COMMAND}`
|
47
|
+
raise "Could not grep for processes -> #{result}" if result.strip != "" && !$?.success?
|
48
|
+
result.split("\n").size
|
53
49
|
end
|
54
50
|
end
|
data/lib/parallel_tests/cli.rb
CHANGED
@@ -20,8 +20,7 @@ module ParallelTests
|
|
20
20
|
|
21
21
|
def execute_in_parallel(items, num_processes, options)
|
22
22
|
Tempfile.open 'parallel_tests-lock' do |lock|
|
23
|
-
|
24
|
-
return Parallel.map(items, mode => num_processes) do |item|
|
23
|
+
return Parallel.map(items, :in_threads => num_processes) do |item|
|
25
24
|
result = yield(item)
|
26
25
|
report_output(result, lock) if options[:serialize_stdout]
|
27
26
|
result
|
@@ -65,8 +65,8 @@ module ParallelTests
|
|
65
65
|
|
66
66
|
output, errput, exitstatus = nil
|
67
67
|
if RUBY_ENGINE == "jruby"
|
68
|
-
|
69
|
-
# JRuby's
|
68
|
+
# - JRuby's popen3 doesn't pass arguments correctly to the shell, so we use stdin
|
69
|
+
# - JRuby's open cannot handle local variables properly so we would have to use instance variables
|
70
70
|
Open3.popen3("sh -") do |stdin, stdout, stderr, thread|
|
71
71
|
stdin.puts cmd
|
72
72
|
stdin.close
|
data/spec/integration_spec.rb
CHANGED
@@ -139,7 +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
|
+
pending if RUBY_ENGINE == "jruby" # just too slow ...
|
143
143
|
2.times{|i|
|
144
144
|
write "spec/xxx#{i}_spec.rb", 'describe("it"){it("should"){sleep 5}}; $stderr.puts ENV["TEST_ENV_NUMBER"]'
|
145
145
|
}
|
@@ -198,7 +198,7 @@ describe 'CLI' do
|
|
198
198
|
end
|
199
199
|
|
200
200
|
it "can wait_for_other_processes_to_finish" do
|
201
|
-
pending if RUBY_ENGINE == "jruby"
|
201
|
+
pending if RUBY_ENGINE == "jruby" # just too slow ...
|
202
202
|
write "test/a_test.rb", "require 'parallel_tests'; sleep 0.5 ; ParallelTests.wait_for_other_processes_to_finish; puts 'a'"
|
203
203
|
write "test/b_test.rb", "sleep 1; puts 'b'"
|
204
204
|
write "test/c_test.rb", "sleep 1.5; puts 'c'"
|
data/spec/parallel_tests_spec.rb
CHANGED
@@ -108,16 +108,7 @@ describe ParallelTests do
|
|
108
108
|
|
109
109
|
it "is 2 when 2 are running" do
|
110
110
|
wait = 0.2
|
111
|
-
2.times
|
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
|
111
|
+
2.times { Thread.new { `TEST_ENV_NUMBER=1; sleep #{wait}` } }
|
121
112
|
sleep wait / 2
|
122
113
|
ParallelTests.number_of_running_processes.should == 2
|
123
114
|
sleep wait
|
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.
|
4
|
+
version: 0.12.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -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: 3143223892246402054
|
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: 3143223892246402054
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
111
|
rubygems_version: 1.8.25
|