parallel_tests 0.4.4 → 0.4.5
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.markdown +6 -4
- data/VERSION +1 -1
- data/bin/parallel_test +5 -2
- data/lib/parallel_specs.rb +11 -4
- data/parallel_tests.gemspec +2 -2
- data/spec/integration_spec.rb +3 -3
- data/spec/parallel_specs_spec.rb +11 -1
- metadata +3 -3
data/README.markdown
CHANGED
@@ -57,15 +57,17 @@ Setup for non-rails
|
|
57
57
|
sudo gem install parallel_tests
|
58
58
|
# go to your project dir
|
59
59
|
parallel_test OR parallel_spec OR parallel_cucumber
|
60
|
-
# [Optional] use ENV['TEST_ENV_NUMBER'] inside your tests
|
60
|
+
# [Optional] use ENV['TEST_ENV_NUMBER'] inside your tests to select separate db/memcache/etc.
|
61
|
+
|
62
|
+
[optional] Only run selected files & folders:
|
63
|
+
parallel_test test/bar test/baz/xxx_text.rb
|
61
64
|
|
62
65
|
Options are:
|
63
66
|
-n [PROCESSES] How many processes to use, default: available CPUs
|
64
67
|
-p, --path [PATH] run tests inside this path only
|
65
|
-
|
66
|
-
-r, --root [PATH] execute test commands from this path
|
67
|
-
-f, --files [FILES] run these test files (comma-separated list w/o spaces)
|
68
|
+
--no-sort do not sort files before running them
|
68
69
|
-m, --multiply-processes [FLOAT] use given number as a multiplier of processes to run
|
70
|
+
-r, --root [PATH] execute test commands from this path
|
69
71
|
-e, --exec [COMMAND] execute this code parallel and with ENV['TEST_ENV_NUM']
|
70
72
|
-o, --test-options '[OPTIONS]' execute test commands with those options
|
71
73
|
-t, --type [TYPE] which type of tests to run? test, spec or features
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.5
|
data/bin/parallel_test
CHANGED
@@ -9,7 +9,10 @@ require "parallel_tests"
|
|
9
9
|
options = {}
|
10
10
|
OptionParser.new do |opts|
|
11
11
|
opts.banner = <<BANNER
|
12
|
-
Run tests in parallel, giving each process ENV['TEST_ENV_NUMBER'] ('', '2', '3', ...)
|
12
|
+
Run all tests in parallel, giving each process ENV['TEST_ENV_NUMBER'] ('', '2', '3', ...)
|
13
|
+
|
14
|
+
[optional] Only run selected files & folders:
|
15
|
+
parallel_test test/bar test/baz/xxx_text.rb
|
13
16
|
|
14
17
|
Options are:
|
15
18
|
BANNER
|
@@ -19,7 +22,7 @@ BANNER
|
|
19
22
|
opts.on("-m [FLOAT]", "--multiply-processes [FLOAT]", Float, "use given number as a multiplier of processes to run"){ |multiply| options[:multiply] = multiply }
|
20
23
|
opts.on("-r", '--root [PATH]', "execute test commands from this path"){|path| options[:root] = path }
|
21
24
|
opts.on("-e", '--exec [COMMAND]', "execute this code parallel and with ENV['TEST_ENV_NUM']"){|path| options[:execute] = path }
|
22
|
-
opts.on("-o", "--test-options '[
|
25
|
+
opts.on("-o", "--test-options '[OPTIONS]'", "execute test commands with those options"){|arg| options[:test_options] = arg }
|
23
26
|
opts.on("-t", "--type [TYPE]", "which type of tests to run? test, spec or features"){|type| options[:type] = type }
|
24
27
|
opts.on('-v', '--version', 'Show Version'){ puts ParallelTests::VERSION; exit}
|
25
28
|
opts.on("-h", "--help", "Show this.") { puts opts; exit }
|
data/lib/parallel_specs.rb
CHANGED
@@ -7,17 +7,24 @@ class ParallelSpecs < ParallelTests
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.executable
|
10
|
-
if
|
11
|
-
"bundle exec spec"
|
12
|
-
elsif File.file?("script/spec")
|
10
|
+
cmd = if File.file?("script/spec")
|
13
11
|
"script/spec"
|
12
|
+
elsif bundler_enabled?
|
13
|
+
cmd = (run("bundle show rspec") =~ %r{/rspec-1[^/]+$} ? "spec" : "rspec")
|
14
|
+
"bundle exec #{cmd}"
|
14
15
|
else
|
15
|
-
|
16
|
+
%w[spec rspec].detect{|cmd| system "#{cmd} --version > /dev/null 2>&1" }
|
16
17
|
end
|
18
|
+
cmd or raise("Can't find executables rspec or spec")
|
17
19
|
end
|
18
20
|
|
19
21
|
protected
|
20
22
|
|
23
|
+
# so it can be stubbed....
|
24
|
+
def self.run(cmd)
|
25
|
+
`#{cmd}`
|
26
|
+
end
|
27
|
+
|
21
28
|
def self.spec_opts
|
22
29
|
opts = ['spec/parallel_spec.opts', 'spec/spec.opts'].detect{|f| File.file?(f) }
|
23
30
|
opts ? "-O #{opts}" : nil
|
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.4.
|
8
|
+
s.version = "0.4.5"
|
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{2010-
|
12
|
+
s.date = %q{2010-08-17}
|
13
13
|
s.email = %q{grosser.michael@gmail.com}
|
14
14
|
s.executables = ["parallel_spec", "parallel_cucumber", "parallel_test"]
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/integration_spec.rb
CHANGED
@@ -88,11 +88,11 @@ describe 'CLI' do
|
|
88
88
|
write 'xxx6_spec.rb', 'describe("it"){it("should"){sleep 2}}'
|
89
89
|
t = Time.now
|
90
90
|
run_specs :processes => 6
|
91
|
-
expected =
|
91
|
+
expected = 10
|
92
92
|
(Time.now - t).should <= expected
|
93
93
|
end
|
94
94
|
|
95
|
-
it "can
|
95
|
+
it "can can with given files" do
|
96
96
|
write "x1_spec.rb", "puts '111'"
|
97
97
|
write "x2_spec.rb", "puts '222'"
|
98
98
|
write "x3_spec.rb", "puts '333'"
|
@@ -106,6 +106,6 @@ describe 'CLI' do
|
|
106
106
|
write "x1_spec.rb", ""
|
107
107
|
write "x2_spec.rb", ""
|
108
108
|
result = run_specs(:add => "--test-options ' --version'", :processes => 2)
|
109
|
-
result.should =~
|
109
|
+
result.should =~ /\d+\.\d+\.\d+\..*\d+\.\d+\.\d+\./m # prints version twice
|
110
110
|
end
|
111
111
|
end
|
data/spec/parallel_specs_spec.rb
CHANGED
@@ -33,12 +33,22 @@ describe ParallelSpecs do
|
|
33
33
|
ParallelSpecs.run_tests(['xxx'],1,'')
|
34
34
|
end
|
35
35
|
|
36
|
-
it "run bundle exec spec when on bundler 0.9" do
|
36
|
+
it "run bundle exec spec when on bundler 0.9 and rspec 1" do
|
37
|
+
File.stub!(:file?).with('script/spec').and_return false
|
37
38
|
ParallelSpecs.stub!(:bundler_enabled?).and_return true
|
39
|
+
ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-1.0.2"
|
38
40
|
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{bundle exec spec}}.and_return mocked_process
|
39
41
|
ParallelSpecs.run_tests(['xxx'],1,'')
|
40
42
|
end
|
41
43
|
|
44
|
+
it "run bundle exec rspec when on bundler 0.9 and rspec 2" do
|
45
|
+
File.stub!(:file?).with('script/spec').and_return false
|
46
|
+
ParallelSpecs.stub!(:bundler_enabled?).and_return true
|
47
|
+
ParallelSpecs.stub!(:run).with("bundle show rspec").and_return "/foo/bar/rspec-2.0.2"
|
48
|
+
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{bundle exec rspec}}.and_return mocked_process
|
49
|
+
ParallelSpecs.run_tests(['xxx'],1,'')
|
50
|
+
end
|
51
|
+
|
42
52
|
it "runs script/spec when script/spec can be found" do
|
43
53
|
File.should_receive(:file?).with('script/spec').and_return true
|
44
54
|
ParallelSpecs.should_receive(:open).with{|x,y| x =~ %r{script/spec}}.and_return mocked_process
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 5
|
9
|
+
version: 0.4.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Michael Grosser
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-08-17 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|