parallel_tests 4.6.0 → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82339af23324161c5818c27e55fdadcbcac91ab832f76ce791a6deb289f77233
4
- data.tar.gz: 0fd923d52f7e368ef4c8e99e7874a465c7213960b1fd6e455404e472dc00ab90
3
+ metadata.gz: 24dc3cca9e186c8d0f50a1a9e4b5fb0e9e9e25f7b42df4108cbaa697165f509f
4
+ data.tar.gz: 2685a07430f93fbad45300ae897472c806d68faa6cfbdb5fc573e41ec96639b5
5
5
  SHA512:
6
- metadata.gz: ee5cb110a617b78e8761c5e01894827b63cccbe6a239b491841949bf2ebe2e9d68a43d4bb0d0a5600cdc6904e8cffba816eb424ca5883865daf661cf7b208f91
7
- data.tar.gz: e23de90f4aed3c4571252385a251c3765718c3e2fd34aaf342307667b6710819aff652b4c1709dab2152fe0b81217f2d2fb1b98cf308d8c40e3190d91374337d
6
+ metadata.gz: c26d0cd7643ce0b728d6a2d482e319b6ea4fd13f168e7a64bf00ad0c18355eaf4bb93ce42b05c239b2b385c6ef1e0b56aafe56117d072081ee61bb0ced066866
7
+ data.tar.gz: 67e6cedb8619d5c8cd094e4ae365372b93c6a806b084f04e3f24e621cb4a7cb077d3095a3d30951298e316c9d75d8020719efea54d8114387171816eaf7997c4
data/Readme.md CHANGED
@@ -61,17 +61,17 @@ test:
61
61
  rake parallel:features # Cucumber
62
62
  rake parallel:features-spinach # Spinach
63
63
 
64
- rake parallel:test[1] --> force 1 CPU --> 86 seconds
64
+ rake "parallel:test[1]" --> force 1 CPU --> 86 seconds
65
65
  rake parallel:test --> got 2 CPUs? --> 47 seconds
66
66
  rake parallel:test --> got 4 CPUs? --> 26 seconds
67
67
  ...
68
68
 
69
69
  Test by pattern with Regex (e.g. use one integration server per subfolder / see if you broke any 'user'-related tests)
70
70
 
71
- rake parallel:test[^test/unit] # every test file in test/unit folder
72
- rake parallel:test[user] # run users_controller + user_helper + user tests
73
- rake parallel:test['user|product'] # run user and product related tests
74
- rake parallel:spec['spec\/(?!features)'] # run RSpec tests except the tests in spec/features
71
+ rake "parallel:test[^test/unit]" # every test file in test/unit folder
72
+ rake "parallel:test[user]" # run users_controller + user_helper + user tests
73
+ rake "parallel:test['user|product']" # run user and product related tests
74
+ rake "parallel:spec['spec\/(?!features)']" # run RSpec tests except the tests in spec/features
75
75
 
76
76
 
77
77
  ### Example output
@@ -87,9 +87,9 @@ Test by pattern with Regex (e.g. use one integration server per subfolder / see
87
87
  ```Bash
88
88
  RAILS_ENV=test parallel_test -e "rake my:custom:task"
89
89
  # or
90
- rake parallel:rake[my:custom:task]
90
+ rake "parallel:rake[my:custom:task]"
91
91
  # limited parallelism
92
- rake parallel:rake[my:custom:task,2]
92
+ rake "parallel:rake[my:custom:task,2]"
93
93
  ```
94
94
 
95
95
 
@@ -250,8 +250,9 @@ Options are:
250
250
  -m, --multiply-processes [FLOAT] use given number as a multiplier of processes to run
251
251
  -s, --single [PATTERN] Run all matching files in the same process
252
252
  -i, --isolate Do not run any other tests in the group used by --single(-s)
253
- --isolate-n [PROCESSES] Use 'isolate' singles with number of processes, default: 1.
253
+ --isolate-n [PROCESSES] Use 'isolate' singles with number of processes, default: 1
254
254
  --highest-exit-status Exit with the highest exit status provided by test run(s)
255
+ --failure-exit-code [INT] Specify the exit code to use when tests fail
255
256
  --specify-groups [SPECS] Use 'specify-groups' if you want to specify multiple specs running in multiple
256
257
  processes in a specific formation. Commas indicate specs in the same process,
257
258
  pipes indicate specs in a new process. Cannot use with --single, --isolate, or
@@ -260,9 +261,8 @@ Options are:
260
261
  Process 1 will contain 1_spec.rb and 2_spec.rb
261
262
  Process 2 will contain 3_spec.rb
262
263
  Process 3 will contain all other specs
263
- --only-group INT[,INT] Only run the given group numbers. Note that this will force the 'filesize'
264
- grouping strategy (even when the runtime log is present) unless you explicitly
265
- set it otherwise via the '-group-by' flag.
264
+ --only-group INT[,INT] Only run the given group numbers.
265
+ Changes `--group-by` default to 'filesize'.
266
266
  -e, --exec [COMMAND] execute this code parallel and with ENV['TEST_ENV_NUMBER']
267
267
  -o, --test-options '[OPTIONS]' execute test commands with those options
268
268
  -t, --type [TYPE] test(default) / rspec / cucumber / spinach
@@ -279,7 +279,7 @@ Options are:
279
279
  --nice execute test commands with low priority.
280
280
  --runtime-log [PATH] Location of previously recorded test runtimes
281
281
  --allowed-missing [INT] Allowed percentage of missing runtimes (default = 50)
282
- --allow-duplicates When detecting files to run, allow duplicates. Useful for local debugging
282
+ --allow-duplicates When detecting files to run, allow duplicates
283
283
  --unknown-runtime [FLOAT] Use given number as unknown runtime (otherwise use average time)
284
284
  --first-is-1 Use "1" as TEST_ENV_NUMBER to not reuse the default test environment
285
285
  --fail-fast Stop all groups when one group fails (best used with --test-options '--fail-fast' if supported
@@ -57,8 +57,8 @@ module ParallelTests
57
57
  Tempfile.open 'parallel_tests-lock' do |lock|
58
58
  ParallelTests.with_pid_file do
59
59
  simulate_output_for_ci options[:serialize_stdout] do
60
- Parallel.map(items, in_threads: num_processes) do |item|
61
- result = yield(item)
60
+ Parallel.map_with_index(items, in_threads: num_processes) do |item, index|
61
+ result = yield(item, index)
62
62
  reprint_output(result, lock.path) if options[:serialize_stdout]
63
63
  ParallelTests.stop_all_processes if options[:fail_fast] && result[:exit_status] != 0
64
64
  result
@@ -81,8 +81,8 @@ module ParallelTests
81
81
  end
82
82
 
83
83
  report_number_of_tests(groups) unless options[:quiet]
84
- test_results = execute_in_parallel(groups, groups.size, options) do |group|
85
- run_tests(group, groups.index(group), num_processes, options)
84
+ test_results = execute_in_parallel(groups, groups.size, options) do |group, index|
85
+ run_tests(group, index, num_processes, options)
86
86
  end
87
87
  report_results(test_results, options) unless options[:quiet]
88
88
  end
@@ -96,8 +96,9 @@ module ParallelTests
96
96
  if any_test_failed?(test_results)
97
97
  warn final_fail_message
98
98
 
99
- # return the highest exit status to allow sub-processes to send things other than 1
100
- exit_status = if options[:highest_exit_status]
99
+ exit_status = if options[:failure_exit_code]
100
+ options[:failure_exit_code]
101
+ elsif options[:highest_exit_status]
101
102
  test_results.map { |data| data.fetch(:exit_status) }.max
102
103
  else
103
104
  1
@@ -223,12 +224,19 @@ module ParallelTests
223
224
  opts.on(
224
225
  "--isolate-n [PROCESSES]",
225
226
  Integer,
226
- "Use 'isolate' singles with number of processes, default: 1."
227
+ "Use 'isolate' singles with number of processes, default: 1"
227
228
  ) { |n| options[:isolate_count] = n }
228
229
 
229
- opts.on("--highest-exit-status", "Exit with the highest exit status provided by test run(s)") do
230
- options[:highest_exit_status] = true
231
- end
230
+ opts.on(
231
+ "--highest-exit-status",
232
+ "Exit with the highest exit status provided by test run(s)"
233
+ ) { options[:highest_exit_status] = true }
234
+
235
+ opts.on(
236
+ "--failure-exit-code [INT]",
237
+ Integer,
238
+ "Specify the exit code to use when tests fail"
239
+ ) { |code| options[:failure_exit_code] = code }
232
240
 
233
241
  opts.on(
234
242
  "--specify-groups [SPECS]",
@@ -237,7 +245,7 @@ module ParallelTests
237
245
  processes in a specific formation. Commas indicate specs in the same process,
238
246
  pipes indicate specs in a new process. Cannot use with --single, --isolate, or
239
247
  --isolate-n. Ex.
240
- $ parallel_test -n 3 . --specify-groups '1_spec.rb,2_spec.rb|3_spec.rb'
248
+ $ parallel_tests -n 3 . --specify-groups '1_spec.rb,2_spec.rb|3_spec.rb'
241
249
  Process 1 will contain 1_spec.rb and 2_spec.rb
242
250
  Process 2 will contain 3_spec.rb
243
251
  Process 3 will contain all other specs
@@ -331,6 +339,10 @@ module ParallelTests
331
339
  raise "Can't pass --specify-groups with any of these keys: --single, --isolate, or --isolate-n"
332
340
  end
333
341
 
342
+ if options[:failure_exit_code] && options[:highest_exit_status]
343
+ raise "Can't pass --failure-exit-code and --highest-exit-status"
344
+ end
345
+
334
346
  options
335
347
  end
336
348
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ParallelTests
3
- VERSION = '4.6.0'
3
+ VERSION = '4.7.0'
4
4
  end
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: 4.6.0
4
+ version: 4.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-25 00:00:00.000000000 Z
11
+ date: 2024-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -69,8 +69,8 @@ licenses:
69
69
  - MIT
70
70
  metadata:
71
71
  bug_tracker_uri: https://github.com/grosser/parallel_tests/issues
72
- documentation_uri: https://github.com/grosser/parallel_tests/blob/v4.6.0/Readme.md
73
- source_code_uri: https://github.com/grosser/parallel_tests/tree/v4.6.0
72
+ documentation_uri: https://github.com/grosser/parallel_tests/blob/v4.7.0/Readme.md
73
+ source_code_uri: https://github.com/grosser/parallel_tests/tree/v4.7.0
74
74
  wiki_uri: https://github.com/grosser/parallel_tests/wiki
75
75
  post_install_message:
76
76
  rdoc_options: []