parallel_tests 0.7.0.rc2 → 0.7.0.rc3

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.7.0.rc2)
4
+ parallel_tests (0.7.0.rc3)
5
5
  parallel
6
6
 
7
7
  GEM
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env ruby
2
- exec "#{File.join(File.dirname(__FILE__), 'parallel_test')} -t cucumber #{ARGV * ' '}"
2
+ exec "#{File.join(File.dirname(__FILE__), 'parallel_test')} -t cucumber #{ARGV.map{|a| "'#{a}'" } * ' '}"
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env ruby
2
+ exec "#{File.join(File.dirname(__FILE__), 'parallel_test')} -t rspec #{ARGV.map{|a| "'#{a}'" } * ' '}"
@@ -1,3 +1,3 @@
1
1
  module ParallelTests
2
- VERSION = Version = '0.7.0.rc2'
2
+ VERSION = Version = '0.7.0.rc3'
3
3
  end
@@ -9,6 +9,6 @@ Gem::Specification.new name, ParallelTests::VERSION do |s|
9
9
  s.homepage = "http://github.com/grosser/#{name}"
10
10
  s.files = `git ls-files`.split("\n")
11
11
  s.license = "MIT"
12
- s.executables = ["parallel_cucumber", "parallel_spec", "parallel_test"]
12
+ s.executables = ["parallel_cucumber", "parallel_rspec", "parallel_test"]
13
13
  s.add_runtime_dependency "parallel"
14
14
  end
@@ -24,8 +24,8 @@ describe 'CLI' do
24
24
  "#{File.expand_path(File.dirname(__FILE__))}/../bin"
25
25
  end
26
26
 
27
- def executable
28
- "#{bin_folder}/parallel_test"
27
+ def executable(options={})
28
+ "#{bin_folder}/parallel_#{options[:type] || 'test'}"
29
29
  end
30
30
 
31
31
  def ensure_folder(folder)
@@ -35,15 +35,16 @@ describe 'CLI' do
35
35
  def run_tests(test_folder, options={})
36
36
  ensure_folder folder
37
37
  processes = "-n #{options[:processes]||2}" unless options[:processes] == false
38
- result = `cd #{folder} && #{options[:export]} #{executable} #{test_folder} --chunk-timeout 999 -t #{options[:type] || 'rspec'} #{processes} #{options[:add]} 2>&1`
39
- raise "FAILED #{result}" if $?.success? == !!options[:fail]
38
+ command = "cd #{folder} && #{options[:export]} #{executable(options)} #{test_folder} --chunk-timeout 999 #{processes} #{options[:add]} 2>&1"
39
+ result = `#{command}`
40
+ raise "FAILED #{command}\n#{result}" if $?.success? == !!options[:fail]
40
41
  result
41
42
  end
42
43
 
43
44
  it "runs tests in parallel" do
44
45
  write 'spec/xxx_spec.rb', 'describe("it"){it("should"){puts "TEST1"}}'
45
46
  write 'spec/xxx2_spec.rb', 'describe("it"){it("should"){puts "TEST2"}}'
46
- result = run_tests "spec"
47
+ result = run_tests "spec", :type => 'rspec'
47
48
 
48
49
  # test ran and gave their puts
49
50
  result.should include('TEST1')
@@ -58,7 +59,7 @@ describe 'CLI' do
58
59
 
59
60
  it "does not run any tests if there are none" do
60
61
  write 'spec/xxx_spec.rb', '1'
61
- result = run_tests "spec"
62
+ result = run_tests "spec", :type => 'rspec'
62
63
  result.should include('No examples found')
63
64
  result.should include('Took')
64
65
  end
@@ -66,37 +67,39 @@ describe 'CLI' do
66
67
  it "fails when tests fail" do
67
68
  write 'spec/xxx_spec.rb', 'describe("it"){it("should"){puts "TEST1"}}'
68
69
  write 'spec/xxx2_spec.rb', 'describe("it"){it("should"){1.should == 2}}'
69
- result = run_tests "spec", :fail => true
70
+ result = run_tests "spec", :fail => true, :type => 'rspec'
70
71
 
71
72
  result.scan('1 example, 1 failure').size.should == 1
72
73
  result.scan('1 example, 0 failure').size.should == 1
73
74
  result.scan('2 examples, 1 failure').size.should == 1
74
75
  end
75
76
 
76
- it "can exec given commands with ENV['TEST_ENV_NUM']" do
77
- result = `#{executable} -e 'ruby -e "print ENV[:TEST_ENV_NUMBER.to_s].to_i"' -n 4`
78
- result.gsub('"','').split('').sort.should == %w[0 2 3 4]
79
- end
77
+ context "with given commands" do
78
+ it "can exec given commands with ENV['TEST_ENV_NUM']" do
79
+ result = `#{executable} -e 'ruby -e "print ENV[:TEST_ENV_NUMBER.to_s].to_i"' -n 4`
80
+ result.gsub('"','').split('').sort.should == %w[0 2 3 4]
81
+ end
80
82
 
81
- it "can exec given command non-parallel" do
82
- result = `#{executable} -e 'ruby -e "sleep(rand(10)/100.0); puts ENV[:TEST_ENV_NUMBER.to_s].inspect"' -n 4 --non-parallel`
83
- result.split("\n").should == %w["" "2" "3" "4"]
84
- end
83
+ it "can exec given command non-parallel" do
84
+ result = `#{executable} -e 'ruby -e "sleep(rand(10)/100.0); puts ENV[:TEST_ENV_NUMBER.to_s].inspect"' -n 4 --non-parallel`
85
+ result.split("\n").should == %w["" "2" "3" "4"]
86
+ end
85
87
 
86
- it "exists with success if all sub-processes returned success" do
87
- system("#{executable} -e 'cat /dev/null' -n 4").should == true
88
- end
88
+ it "exists with success if all sub-processes returned success" do
89
+ system("#{executable} -e 'cat /dev/null' -n 4").should == true
90
+ end
89
91
 
90
- it "exists with failure if any sub-processes returned failure" do
91
- system("#{executable} -e 'test -e xxxx' -n 4").should == false
92
+ it "exists with failure if any sub-processes returned failure" do
93
+ system("#{executable} -e 'test -e xxxx' -n 4").should == false
94
+ end
92
95
  end
93
96
 
94
- it "can run through parallel_spec" do
97
+ it "runs through parallel_rspec" do
95
98
  version = `#{executable} -v`
96
- `#{bin_folder}/parallel_spec -v`.should == version
99
+ `#{bin_folder}/parallel_rspec -v`.should == version
97
100
  end
98
101
 
99
- it "can run through parallel_spec" do
102
+ it "runs through parallel_cucumber" do
100
103
  version = `#{executable} -v`
101
104
  `#{bin_folder}/parallel_cucumber -v`.should == version
102
105
  end
@@ -106,7 +109,7 @@ describe 'CLI' do
106
109
  write "spec/xxx#{i}_spec.rb", 'describe("it"){it("should"){sleep 5}}; $stderr.puts ENV["TEST_ENV_NUMBER"]'
107
110
  }
108
111
  t = Time.now
109
- run_tests("spec", :processes => 2)
112
+ run_tests("spec", :processes => 2, :type => 'rspec')
110
113
  expected = 10
111
114
  (Time.now - t).should <= expected
112
115
  end
@@ -115,14 +118,14 @@ describe 'CLI' do
115
118
  write "spec/x1_spec.rb", "puts '111'"
116
119
  write "spec/x2_spec.rb", "puts '222'"
117
120
  write "spec/x3_spec.rb", "puts '333'"
118
- result = run_tests("spec/x1_spec.rb spec/x3_spec.rb")
121
+ result = run_tests "spec/x1_spec.rb spec/x3_spec.rb", :type => 'rspec'
119
122
  result.should include('111')
120
123
  result.should include('333')
121
124
  result.should_not include('222')
122
125
  end
123
126
 
124
127
  it "runs successfully without any files" do
125
- results = run_tests("")
128
+ results = run_tests "", :type => 'rspec'
126
129
  results.should include("2 processes for 0 specs")
127
130
  results.should include("Took")
128
131
  end
@@ -130,7 +133,10 @@ describe 'CLI' do
130
133
  it "can run with test-options" do
131
134
  write "spec/x1_spec.rb", "111"
132
135
  write "spec/x2_spec.rb", "111"
133
- result = run_tests("spec", :add => "--test-options ' --version'", :processes => 2)
136
+ result = run_tests "spec",
137
+ :add => "--test-options ' --version'",
138
+ :processes => 2,
139
+ :type => 'rspec'
134
140
  result.should =~ /\d+\.\d+\.\d+.*\d+\.\d+\.\d+/m # prints version twice
135
141
  end
136
142
 
@@ -139,7 +145,10 @@ describe 'CLI' do
139
145
  processes.times{|i|
140
146
  write "spec/x#{i}_spec.rb", "puts %{ENV-\#{ENV['TEST_ENV_NUMBER']}-}"
141
147
  }
142
- result = run_tests("spec", :export => "PARALLEL_TEST_PROCESSORS=#{processes}", :processes => processes)
148
+ result = run_tests "spec",
149
+ :export => "PARALLEL_TEST_PROCESSORS=#{processes}",
150
+ :processes => processes,
151
+ :type => 'rspec'
143
152
  result.scan(/ENV-.?-/).should =~ ["ENV--", "ENV-2-", "ENV-3-", "ENV-4-", "ENV-5-"]
144
153
  end
145
154
 
@@ -147,7 +156,7 @@ describe 'CLI' do
147
156
  write "spec/x_spec.rb", "puts 'XXX'"
148
157
  write "spec/y_spec.rb", "puts 'YYY'"
149
158
  write "spec/z_spec.rb", "puts 'ZZZ'"
150
- result = run_tests("spec", :add => '-p "^spec/(x|z)"')
159
+ result = run_tests "spec", :add => "-p '^spec/(x|z)'", :type => "rspec"
151
160
  result.should include('XXX')
152
161
  result.should_not include('YYY')
153
162
  result.should include('ZZZ')
@@ -156,18 +165,18 @@ describe 'CLI' do
156
165
  context "Test::Unit" do
157
166
  it "runs" do
158
167
  write "test/x1_test.rb", "require 'test/unit'; class XTest < Test::Unit::TestCase; def test_xxx; end; end"
159
- result = run_tests("test", :type => :test)
168
+ result = run_tests("test")
160
169
  result.should include('1 test')
161
170
  end
162
171
 
163
172
  it "passes test options" do
164
173
  write "test/x1_test.rb", "require 'test/unit'; class XTest < Test::Unit::TestCase; def test_xxx; end; end"
165
- result = run_tests("test", :type => :test, :add => '--test-options "-v"')
174
+ result = run_tests("test", :add => '--test-options "-v"')
166
175
  result.should include('test_xxx') # verbose output of every test
167
176
  end
168
177
 
169
178
  it "runs successfully without any files" do
170
- results = run_tests("", :type => "test")
179
+ results = run_tests("")
171
180
  results.should include("2 processes for 0 tests")
172
181
  results.should include("Took")
173
182
  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.7.0.rc2
4
+ version: 0.7.0.rc3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: parallel
16
- requirement: &18742180 !ruby/object:Gem::Requirement
16
+ requirement: &15917780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,12 +21,12 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *18742180
24
+ version_requirements: *15917780
25
25
  description:
26
26
  email: michael@grosser.it
27
27
  executables:
28
28
  - parallel_cucumber
29
- - parallel_spec
29
+ - parallel_rspec
30
30
  - parallel_test
31
31
  extensions: []
32
32
  extra_rdoc_files: []
@@ -38,7 +38,7 @@ files:
38
38
  - Readme.md
39
39
  - ReadmeRails2.md
40
40
  - bin/parallel_cucumber
41
- - bin/parallel_spec
41
+ - bin/parallel_rspec
42
42
  - bin/parallel_test
43
43
  - lib/parallel_tests.rb
44
44
  - lib/parallel_tests/cli.rb
@@ -81,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  segments:
83
83
  - 0
84
- hash: 3769225789996379238
84
+ hash: -1571791250058150981
85
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env ruby
2
- exec "#{File.join(File.dirname(__FILE__), 'parallel_test')} -t spec #{ARGV * ' '}"