parallel_tests 3.5.2 → 3.7.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d0652212f051b70b99ae872c05fb5ab37fbd5a13270d2158820555cd472a689
4
- data.tar.gz: 29c4e9cfbc3268880ce9ead6033e853588806503b0cc1bdfaf427ba6cd31b237
3
+ metadata.gz: 042cf590688332180e07fcf6472cc9b88b740276df0511677cf77f7fe649fa2e
4
+ data.tar.gz: cb4fd166b030e16574bf5d4790e5d1e0a3d57001d5474ab81c3d54613af976e2
5
5
  SHA512:
6
- metadata.gz: b8cbab7441e101617611cb37908656c416d9901b4ca02cf85920de646b1c0e750e6c37ae4690be7ae8d4c79640db2e7505bcbd331d0c3072a1e60e1f0ff5b462
7
- data.tar.gz: 635508aa6168d0b7e58e8e932d61b079bc25135339c1adf4121707d4849cc9cedfc1acc134dce586112eac23f5e04f6083aeb133ccfb7505a42ea754ecc5f5ae
6
+ metadata.gz: 98e679733a74273ac77e71db47bc3af3f0f5a928dab351be9419644a0e7fe2bc004a81c929928ef0bd98ea2b8e5b63d1ab9fadcf75e22d098a65c5164343fe0b
7
+ data.tar.gz: 2ce2dd070733cd0bb61d0cb610f886a5590d5e267cc43613ab7d08fc251d989ebd4a58ad2f0a9c88478499fe55ff4cb7386fabc2eba8ee7fb3440d4899594654
data/Readme.md CHANGED
@@ -42,6 +42,9 @@ test:
42
42
 
43
43
  ### Setup environment from scratch (create db and loads schema, useful for CI)
44
44
  rake parallel:setup
45
+
46
+ ### Drop all test databases
47
+ rake parallel:drop
45
48
 
46
49
  ### Run!
47
50
  rake parallel:test # Test::Unit
@@ -182,19 +185,24 @@ Setup for non-rails
182
185
 
183
186
  gem install parallel_tests
184
187
  # go to your project dir
185
- parallel_test test/
186
- parallel_rspec spec/
187
- parallel_cucumber features/
188
- parallel_spinach features/
188
+ parallel_test
189
+ parallel_rspec
190
+ parallel_cucumber
191
+ parallel_spinach
189
192
 
190
- - use `ENV['TEST_ENV_NUMBER']` inside your tests to select separate db/memcache/etc.
191
- - Only run selected files & folders:
193
+ - use `ENV['TEST_ENV_NUMBER']` inside your tests to select separate db/memcache/etc. (docker compose: expose it)
192
194
 
195
+ - Only run a subset of files / folders:
196
+
193
197
  `parallel_test test/bar test/baz/foo_text.rb`
194
198
 
195
199
  - Pass test-options and files via `--`:
196
-
197
- `parallel_test -- -t acceptance -f progress -- spec/foo_spec.rb spec/acceptance`
200
+
201
+ `parallel_rspec -- -t acceptance -f progress -- spec/foo_spec.rb spec/acceptance`
202
+
203
+ - Pass in test options, by using the -o flag (wrap everything in quotes):
204
+
205
+ `parallel_cucumber -n 2 -o '-p foo_profile --tags @only_this_tag or @only_that_tag --format summary'`
198
206
 
199
207
  Options are:
200
208
  <!-- copy output from bundle exec ./bin/parallel_test -h -->
@@ -202,22 +210,21 @@ Options are:
202
210
  -p, --pattern [PATTERN] run tests matching this regex pattern
203
211
  --exclude-pattern [PATTERN] exclude tests matching this regex pattern
204
212
  --group-by [TYPE] group tests by:
205
- found - order of finding files
206
- steps - number of cucumber/spinach steps
207
- scenarios - individual cucumber scenarios
208
- filesize - by size of the file
209
- runtime - info from runtime log
210
- default - runtime when runtime log is filled otherwise filesize
213
+ found - order of finding files
214
+ steps - number of cucumber/spinach steps
215
+ scenarios - individual cucumber scenarios
216
+ filesize - by size of the file
217
+ runtime - info from runtime log
218
+ default - runtime when runtime log is filled otherwise filesize
211
219
  -m, --multiply-processes [FLOAT] use given number as a multiplier of processes to run
212
220
  -s, --single [PATTERN] Run all matching files in the same process
213
- -i, --isolate Do not run any other tests in the group used by --single(-s).
214
- Automatically turned on if --isolate-n is set above 0.
215
- --isolate-n Number of processes for isolated groups. Default to 1 when --isolate is on.
221
+ -i, --isolate Do not run any other tests in the group used by --single(-s)
222
+ --isolate-n [PROCESSES] Use 'isolate' singles with number of processes, default: 1.
223
+ --highest-exit-status Exit with the highest exit status provided by test run(s)
216
224
  --specify-groups [SPECS] Use 'specify-groups' if you want to specify multiple specs running in multiple
217
225
  processes in a specific formation. Commas indicate specs in the same process,
218
- pipes indicate specs in a new process. Cannot use with --single, --isolate, or
226
+ pipes indicate specs in a new process. Cannot use with --single, --isolate, or
219
227
  --isolate-n. Ex.
220
- Ex.
221
228
  $ parallel_tests -n 3 . --specify-groups '1_spec.rb,2_spec.rb|3_spec.rb'
222
229
  Process 1 will contain 1_spec.rb and 2_spec.rb
223
230
  Process 2 will contain 3_spec.rb
@@ -227,8 +234,8 @@ Options are:
227
234
  -o, --test-options '[OPTIONS]' execute test commands with those options
228
235
  -t, --type [TYPE] test(default) / rspec / cucumber / spinach
229
236
  --suffix [PATTERN] override built in test file pattern (should match suffix):
230
- '_spec.rb$' - matches rspec files
231
- '_(test|spec).rb$' - matches test or spec files
237
+ '_spec.rb$' - matches rspec files
238
+ '_(test|spec).rb$' - matches test or spec files
232
239
  --serialize-stdout Serialize stdout output, nothing will be written until everything is done
233
240
  --prefix-output-with-test-env-number
234
241
  Prefixes test env number to the output when not using --serialize-stdout
@@ -394,6 +401,7 @@ inspired by [pivotal labs](https://blog.pivotal.io/labs/labs/parallelize-your-rs
394
401
  - [Nathan Broadbent](https://github.com/ndbroadbent)
395
402
  - [Vikram B Kumar](https://github.com/v-kumar)
396
403
  - [Joshua Pinter](https://github.com/joshuapinter)
404
+ - [Zach Dennis](https://github.com/zdennis)
397
405
 
398
406
  [Michael Grosser](http://grosser.it)<br/>
399
407
  michael@grosser.it<br/>
@@ -84,7 +84,18 @@ module ParallelTests
84
84
  report_time_taken(&run_tests_proc)
85
85
  end
86
86
 
87
- abort final_fail_message if any_test_failed?(test_results)
87
+ if any_test_failed?(test_results)
88
+ warn final_fail_message
89
+
90
+ # return the highest exit status to allow sub-processes to send things other than 1
91
+ exit_status = if options[:highest_exit_status]
92
+ test_results.map { |data| data.fetch(:exit_status) }.max
93
+ else
94
+ 1
95
+ end
96
+
97
+ exit exit_status
98
+ end
88
99
  end
89
100
 
90
101
  def run_tests(group, process_number, num_processes, options)
@@ -105,13 +116,11 @@ module ParallelTests
105
116
 
106
117
  def lock(lockfile)
107
118
  File.open(lockfile) do |lock|
108
- begin
109
- lock.flock File::LOCK_EX
110
- yield
111
- ensure
112
- # This shouldn't be necessary, but appears to be
113
- lock.flock File::LOCK_UN
114
- end
119
+ lock.flock File::LOCK_EX
120
+ yield
121
+ ensure
122
+ # This shouldn't be necessary, but appears to be
123
+ lock.flock File::LOCK_UN
115
124
  end
116
125
  end
117
126
 
@@ -209,6 +218,10 @@ module ParallelTests
209
218
  "Use 'isolate' singles with number of processes, default: 1."
210
219
  ) { |n| options[:isolate_count] = n }
211
220
 
221
+ opts.on("--highest-exit-status", "Exit with the highest exit status provided by test run(s)") do
222
+ options[:highest_exit_status] = true
223
+ end
224
+
212
225
  opts.on(
213
226
  "--specify-groups [SPECS]",
214
227
  <<~TEXT.rstrip.split("\n").join("\n#{newline_padding}")
@@ -228,12 +241,10 @@ module ParallelTests
228
241
  opts.on("-e", "--exec [COMMAND]", "execute this code parallel and with ENV['TEST_ENV_NUMBER']") { |path| options[:execute] = path }
229
242
  opts.on("-o", "--test-options '[OPTIONS]'", "execute test commands with those options") { |arg| options[:test_options] = arg.lstrip }
230
243
  opts.on("-t", "--type [TYPE]", "test(default) / rspec / cucumber / spinach") do |type|
231
- begin
232
- @runner = load_runner(type)
233
- rescue NameError, LoadError => e
234
- puts "Runner for `#{type}` type has not been found! (#{e})"
235
- abort
236
- end
244
+ @runner = load_runner(type)
245
+ rescue NameError, LoadError => e
246
+ puts "Runner for `#{type}` type has not been found! (#{e})"
247
+ abort
237
248
  end
238
249
  opts.on(
239
250
  "--suffix [PATTERN]",
@@ -278,7 +289,14 @@ module ParallelTests
278
289
 
279
290
  files, remaining = extract_file_paths(argv)
280
291
  unless options[:execute]
281
- abort "Pass files or folders to run" unless files.any?
292
+ if files.empty?
293
+ default_test_folder = @runner.default_test_folder
294
+ if File.directory?(default_test_folder)
295
+ files = [default_test_folder]
296
+ else
297
+ abort "Pass files or folders to run"
298
+ end
299
+ end
282
300
  options[:files] = files.map { |file_path| Pathname.new(file_path).cleanpath.to_s }
283
301
  end
284
302
 
@@ -12,6 +12,10 @@ module ParallelTests
12
12
  'cucumber'
13
13
  end
14
14
 
15
+ def default_test_folder
16
+ 'features'
17
+ end
18
+
15
19
  def line_is_result?(line)
16
20
  super || line =~ SCENARIO_REGEX || line =~ SCENARIOS_RESULTS_BOUNDARY_REGEX
17
21
  end
@@ -24,8 +24,8 @@ module ParallelTests
24
24
  cmd = [
25
25
  executable,
26
26
  (runtime_logging if File.directory?(File.dirname(runtime_log))),
27
- cucumber_opts(options[:test_options]),
28
- *sanitized_test_files
27
+ *sanitized_test_files,
28
+ cucumber_opts(options[:test_options])
29
29
  ].compact.reject(&:empty?).join(' ')
30
30
  execute_command(cmd, process_number, num_processes, options)
31
31
  end
@@ -34,6 +34,10 @@ module ParallelTests
34
34
  @test_file_name || 'feature'
35
35
  end
36
36
 
37
+ def default_test_folder
38
+ 'features'
39
+ end
40
+
37
41
  def test_suffix
38
42
  /\.feature$/
39
43
  end
@@ -26,6 +26,10 @@ module ParallelTests
26
26
  "tmp/parallel_runtime_rspec.log"
27
27
  end
28
28
 
29
+ def default_test_folder
30
+ "spec"
31
+ end
32
+
29
33
  def test_file_name
30
34
  "spec"
31
35
  end
@@ -9,6 +9,10 @@ module ParallelTests
9
9
  'spinach'
10
10
  end
11
11
 
12
+ def default_test_folder
13
+ 'features'
14
+ end
15
+
12
16
  def runtime_logging
13
17
  # Not Yet Supported
14
18
  ""
@@ -15,12 +15,16 @@ module ParallelTests
15
15
  /_(test|spec).rb$/
16
16
  end
17
17
 
18
+ def default_test_folder
19
+ "test"
20
+ end
21
+
18
22
  def test_file_name
19
23
  "test"
20
24
  end
21
25
 
22
26
  def run_tests(test_files, process_number, num_processes, options)
23
- require_list = test_files.map { |file| file.sub(" ", "\\ ") }.join(" ")
27
+ require_list = test_files.map { |file| file.gsub(" ", "\\ ") }.join(" ")
24
28
  cmd = "#{executable} -Itest -e '%w[#{require_list}].each { |f| require %{./\#{f}} }' -- #{options[:test_options]}"
25
29
  execute_command(cmd, process_number, num_processes, options)
26
30
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ParallelTests
3
- VERSION = '3.5.2'
3
+ VERSION = '3.7.3'
4
4
  end
@@ -23,16 +23,14 @@ module ParallelTests
23
23
 
24
24
  def with_pid_file
25
25
  Tempfile.open('parallel_tests-pidfile') do |f|
26
- begin
27
- ENV['PARALLEL_PID_FILE'] = f.path
28
- # Pids object should be created before threads will start adding pids to it
29
- # Otherwise we would have to use Mutex to prevent creation of several instances
30
- @pids = pids
31
- yield
32
- ensure
33
- ENV['PARALLEL_PID_FILE'] = nil
34
- @pids = nil
35
- end
26
+ ENV['PARALLEL_PID_FILE'] = f.path
27
+ # Pids object should be created before threads will start adding pids to it
28
+ # Otherwise we would have to use Mutex to prevent creation of several instances
29
+ @pids = pids
30
+ yield
31
+ ensure
32
+ ENV['PARALLEL_PID_FILE'] = nil
33
+ @pids = nil
36
34
  end
37
35
  end
38
36
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parallel_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.2
4
+ version: 3.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-08 00:00:00.000000000 Z
11
+ date: 2021-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -68,8 +68,8 @@ licenses:
68
68
  - MIT
69
69
  metadata:
70
70
  bug_tracker_uri: https://github.com/grosser/parallel_tests/issues
71
- documentation_uri: https://github.com/grosser/parallel_tests/blob/v3.5.2/Readme.md
72
- source_code_uri: https://github.com/grosser/parallel_tests/tree/v3.5.2
71
+ documentation_uri: https://github.com/grosser/parallel_tests/blob/v3.7.3/Readme.md
72
+ source_code_uri: https://github.com/grosser/parallel_tests/tree/v3.7.3
73
73
  wiki_uri: https://github.com/grosser/parallel_tests/wiki
74
74
  post_install_message:
75
75
  rdoc_options: []
@@ -79,14 +79,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 2.4.0
82
+ version: 2.5.0
83
83
  required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  requirements:
85
85
  - - ">="
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  requirements: []
89
- rubygems_version: 3.1.3
89
+ rubygems_version: 3.2.16
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: Run Test::Unit / RSpec / Cucumber / Spinach in parallel