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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- parallel_tests (0.11.6)
4
+ parallel_tests (0.12.0)
5
5
  parallel
6
6
 
7
7
  GEM
@@ -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
- 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
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
@@ -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
- mode = (RUBY_ENGINE == "jruby" ? :in_threads : :in_processes)
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
- Thread.current[:running_parallel_test] = true
69
- # JRuby's popen3 doesn't pass arguments correctly to the shell, so we use stdin
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
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '0.11.6'
2
+ VERSION = Version = '0.12.0'
3
3
  end
@@ -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'"
@@ -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 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
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.11.6
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: -3981454467502280658
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: -3981454467502280658
108
+ hash: 3143223892246402054
109
109
  requirements: []
110
110
  rubyforge_project:
111
111
  rubygems_version: 1.8.25