parallel_tests 0.8.3 → 0.8.4
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/Gemfile.lock +1 -1
- data/Readme.md +2 -1
- data/lib/parallel_tests/cli.rb +4 -3
- data/lib/parallel_tests/test/runner.rb +10 -5
- data/lib/parallel_tests/version.rb +1 -1
- data/spec/parallel_tests/test/runner_spec.rb +9 -0
- metadata +4 -4
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
@@ -122,7 +122,7 @@ Options are:
|
|
122
122
|
|
123
123
|
-n [PROCESSES] How many processes to use, default: available CPUs
|
124
124
|
-p, --pattern [PATTERN] run tests matching this pattern
|
125
|
-
--group-by
|
125
|
+
--group-by [TYPE] group tests by:
|
126
126
|
found - order of finding files
|
127
127
|
steps - number of cucumber steps
|
128
128
|
default - runtime or filesize
|
@@ -133,6 +133,7 @@ Options are:
|
|
133
133
|
-t, --type [TYPE] test(default) / rspec / cucumber
|
134
134
|
--non-parallel execute same commands but do not in parallel, needs --exec
|
135
135
|
--chunk-timeout [TIMEOUT] timeout before re-printing the output of a child-process
|
136
|
+
--no-symlinks Do not traverse symbolic links to find test files
|
136
137
|
-v, --version Show Version
|
137
138
|
-h, --help Show this.
|
138
139
|
|
data/lib/parallel_tests/cli.rb
CHANGED
@@ -80,7 +80,7 @@ Run all tests in parallel, giving each process ENV['TEST_ENV_NUMBER'] ('', '2',
|
|
80
80
|
Options are:
|
81
81
|
BANNER
|
82
82
|
opts.on("-n [PROCESSES]", Integer, "How many processes to use, default: available CPUs") { |n| options[:count] = n }
|
83
|
-
opts.on("-p",
|
83
|
+
opts.on("-p", "--pattern [PATTERN]", "run tests matching this pattern") { |pattern| options[:pattern] = /#{pattern}/ }
|
84
84
|
opts.on("--group-by [TYPE]", <<-TEXT
|
85
85
|
group tests by:
|
86
86
|
found - order of finding files
|
@@ -93,12 +93,13 @@ TEXT
|
|
93
93
|
options[:single_process] ||= []
|
94
94
|
options[:single_process] << /#{pattern}/
|
95
95
|
end
|
96
|
-
opts.on("-e",
|
96
|
+
opts.on("-e", "--exec [COMMAND]", "execute this code parallel and with ENV['TEST_ENV_NUM']") { |path| options[:execute] = path }
|
97
97
|
opts.on("-o", "--test-options '[OPTIONS]'", "execute test commands with those options") { |arg| options[:test_options] = arg }
|
98
98
|
opts.on("-t", "--type [TYPE]", "test(default) / rspec / cucumber") { |type| options[:type] = type }
|
99
99
|
opts.on("--non-parallel", "execute same commands but do not in parallel, needs --exec") { options[:non_parallel] = true }
|
100
100
|
opts.on("--chunk-timeout [TIMEOUT]", "timeout before re-printing the output of a child-process") { |timeout| options[:chunk_timeout] = timeout.to_f }
|
101
|
-
opts.on(
|
101
|
+
opts.on("--no-symlinks", "Do not traverse symbolic links to find test files") { options[:symlinks] = false }
|
102
|
+
opts.on("-v", "--version", "Show Version") { puts ParallelTests::VERSION; exit }
|
102
103
|
opts.on("-h", "--help", "Show this.") { puts opts; exit }
|
103
104
|
end.parse!(argv)
|
104
105
|
|
@@ -121,7 +121,7 @@ module ParallelTests
|
|
121
121
|
def self.find_tests(tests, options={})
|
122
122
|
(tests||[]).map do |file_or_folder|
|
123
123
|
if File.directory?(file_or_folder)
|
124
|
-
files = files_in_folder(file_or_folder)
|
124
|
+
files = files_in_folder(file_or_folder, options)
|
125
125
|
files.grep(/#{Regexp.escape test_suffix}$/).grep(options[:pattern]||//)
|
126
126
|
else
|
127
127
|
file_or_folder
|
@@ -129,10 +129,15 @@ module ParallelTests
|
|
129
129
|
end.flatten.uniq
|
130
130
|
end
|
131
131
|
|
132
|
-
def self.files_in_folder(folder)
|
133
|
-
|
134
|
-
|
135
|
-
|
132
|
+
def self.files_in_folder(folder, options={})
|
133
|
+
pattern = if options[:symlinks] == false # not nil or true
|
134
|
+
"**/*"
|
135
|
+
else
|
136
|
+
# follow one symlink and direct children
|
137
|
+
# http://stackoverflow.com/questions/357754/can-i-traverse-symlinked-directories-in-ruby-with-a-glob
|
138
|
+
"**{,/*/**}/*"
|
139
|
+
end
|
140
|
+
Dir[File.join(folder, pattern)].uniq
|
136
141
|
end
|
137
142
|
end
|
138
143
|
end
|
@@ -152,6 +152,15 @@ EOF
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
+
it "finds test files but ignores those in symlinked folders" do
|
156
|
+
with_files(['a/a_test.rb','b/b_test.rb']) do |root|
|
157
|
+
`ln -s #{root}/a #{root}/b/link`
|
158
|
+
call(["#{root}/b"], :symlinks => false).sort.should == [
|
159
|
+
"#{root}/b/b_test.rb",
|
160
|
+
]
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
155
164
|
it "finds test files nested in different folders" do
|
156
165
|
with_files(['a/a_test.rb','b/b_test.rb', 'c/c_test.rb']) do |root|
|
157
166
|
call(["#{root}/a", "#{root}/b"]).sort.should == [
|
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.8.
|
4
|
+
version: 0.8.4
|
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: 2012-07-
|
12
|
+
date: 2012-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parallel
|
@@ -90,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
segments:
|
92
92
|
- 0
|
93
|
-
hash: -
|
93
|
+
hash: -4352567482093763960
|
94
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
segments:
|
101
101
|
- 0
|
102
|
-
hash: -
|
102
|
+
hash: -4352567482093763960
|
103
103
|
requirements: []
|
104
104
|
rubyforge_project:
|
105
105
|
rubygems_version: 1.8.24
|