parallel_tests 4.7.2 → 4.9.0

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: e432543f3ce9e19888f91f4a11e14b073305a7f3fa8fa69a31cd3db96606d187
4
- data.tar.gz: 1c78c9c74dbbef031ca758d3bec296e4b5d74e7beb8108f604679a45899db070
3
+ metadata.gz: 023c4b3240d2e45fec61eeff4482d8498fc77b552f982462a15383c2ad2598b6
4
+ data.tar.gz: 1a500c45f548c89f8fdfbb2797fa9377f60a2772815df26fbb54b7c56b6ce92f
5
5
  SHA512:
6
- metadata.gz: 95cf6bc8c16eca666478417a73d674b5707506c798f3418bbfee339c27de173b5284de9e53d4120ebb4be6ee559f0a042b64e515bde05e4d7e3f08ff568baf21
7
- data.tar.gz: a02b65aa9fdd77cb9c42f6c1e96ecff0c84affa85b525dc273b020dafc73d3715b40a0b4b64059d6cbc69940a5c7e3604bb1c9f61ff243c416bfe0aaedec3dd4
6
+ metadata.gz: 3fe74eb01f30854917cff7bdeacf34903d360d202a27a9eb2aa6189981a0afad8646ce292d727817e8080fd23874313feea9af99b943cd52afa3611d981a6aa7
7
+ data.tar.gz: 20dd38f628d8142a6069f2e443b8bc3e091731e878e665035e73e68533f79be54ae2a62cf6d7ebeebfeb1187bd7e142ba16a44922ccd1a18829ed29715c6bc6f
data/Readme.md CHANGED
@@ -238,23 +238,23 @@ Setup for non-rails
238
238
 
239
239
  Options are:
240
240
  <!-- copy output from bundle exec ./bin/parallel_test -h -->
241
- -n [PROCESSES] How many processes to use, default: available CPUs
242
- -p, --pattern [PATTERN] run tests matching this regex pattern
243
- --exclude-pattern [PATTERN] exclude tests matching this regex pattern
244
- --group-by [TYPE] group tests by:
241
+ -n PROCESSES How many processes to use, default: available CPUs
242
+ -p, --pattern PATTERN run tests matching this regex pattern
243
+ --exclude-pattern PATTERN exclude tests matching this regex pattern
244
+ --group-by TYPE group tests by:
245
245
  found - order of finding files
246
246
  steps - number of cucumber/spinach steps
247
247
  scenarios - individual cucumber scenarios
248
248
  filesize - by size of the file
249
249
  runtime - info from runtime log
250
250
  default - runtime when runtime log is filled otherwise filesize
251
- -m, --multiply-processes [FLOAT] use given number as a multiplier of processes to run
252
- -s, --single [PATTERN] Run all matching files in the same process
251
+ -m, --multiply-processes COUNT use given number as a multiplier of processes to run
252
+ -s, --single PATTERN Run all matching files in the same process
253
253
  -i, --isolate Do not run any other tests in the group used by --single(-s)
254
- --isolate-n [PROCESSES] Use 'isolate' singles with number of processes, default: 1
254
+ --isolate-n PROCESSES Use 'isolate' singles with number of processes, default: 1
255
255
  --highest-exit-status Exit with the highest exit status provided by test run(s)
256
- --failure-exit-code [INT] Specify the exit code to use when tests fail
257
- --specify-groups [SPECS] Use 'specify-groups' if you want to specify multiple specs running in multiple
256
+ --failure-exit-code INT Specify the exit code to use when tests fail
257
+ --specify-groups SPECS Use 'specify-groups' if you want to specify multiple specs running in multiple
258
258
  processes in a specific formation. Commas indicate specs in the same process,
259
259
  pipes indicate specs in a new process. Cannot use with --single, --isolate, or
260
260
  --isolate-n. Ex.
@@ -262,12 +262,13 @@ Options are:
262
262
  Process 1 will contain 1_spec.rb and 2_spec.rb
263
263
  Process 2 will contain 3_spec.rb
264
264
  Process 3 will contain all other specs
265
- --only-group INT[,INT] Only run the given group numbers.
265
+ --only-group GROUP_INDEX[,GROUP_INDEX]
266
+ Only run the given group numbers.
266
267
  Changes `--group-by` default to 'filesize'.
267
- -e, --exec [COMMAND] execute this code parallel and with ENV['TEST_ENV_NUMBER']
268
- -o, --test-options '[OPTIONS]' execute test commands with those options
269
- -t, --type [TYPE] test(default) / rspec / cucumber / spinach
270
- --suffix [PATTERN] override built in test file pattern (should match suffix):
268
+ -e, --exec COMMAND execute this code parallel and with ENV['TEST_ENV_NUMBER']
269
+ -o, --test-options 'OPTIONS' execute test commands with those options
270
+ -t, --type TYPE test(default) / rspec / cucumber / spinach
271
+ --suffix PATTERN override built in test file pattern (should match suffix):
271
272
  '_spec.rb$' - matches rspec files
272
273
  '_(test|spec).rb$' - matches test or spec files
273
274
  --serialize-stdout Serialize stdout output, nothing will be written until everything is done
@@ -276,14 +277,15 @@ Options are:
276
277
  --combine-stderr Combine stderr into stdout, useful in conjunction with --serialize-stdout
277
278
  --non-parallel execute same commands but do not in parallel, needs --exec
278
279
  --no-symlinks Do not traverse symbolic links to find test files
279
- --ignore-tags [PATTERN] When counting steps ignore scenarios with tags that match this pattern
280
+ --ignore-tags PATTERN When counting steps ignore scenarios with tags that match this pattern
280
281
  --nice execute test commands with low priority.
281
- --runtime-log [PATH] Location of previously recorded test runtimes
282
- --allowed-missing [INT] Allowed percentage of missing runtimes (default = 50)
282
+ --runtime-log PATH Location of previously recorded test runtimes
283
+ --allowed-missing COUNT Allowed percentage of missing runtimes (default = 50)
283
284
  --allow-duplicates When detecting files to run, allow duplicates
284
- --unknown-runtime [FLOAT] Use given number as unknown runtime (otherwise use average time)
285
+ --unknown-runtime SECONDS Use given number as unknown runtime (otherwise use average time)
285
286
  --first-is-1 Use "1" as TEST_ENV_NUMBER to not reuse the default test environment
286
287
  --fail-fast Stop all groups when one group fails (best used with --test-options '--fail-fast' if supported
288
+ --test-file-limit LIMIT Limit to this number of files per test run by batching (for windows set to ~100 to stay below 8192 max command limit, might have bugs from reusing test-env-number and summarizing partial results)
287
289
  --verbose Print debug output
288
290
  --verbose-command Combines options --verbose-process-command and --verbose-rerun-command
289
291
  --verbose-process-command Print the command that will be executed by each process before it begins
@@ -343,6 +345,7 @@ TIPS
343
345
  - [Capybara setup](https://github.com/grosser/parallel_tests/wiki)
344
346
  - [Sphinx setup](https://github.com/grosser/parallel_tests/wiki)
345
347
  - [Capistrano setup](https://github.com/grosser/parallel_tests/wiki/Remotely-with-capistrano) let your tests run on a big box instead of your laptop
348
+ - Rails vs `ArgumentError: secret_key_base`: use `config.secret_key_base = Random.hex(64)`, see [rails issue](https://github.com/rails/rails/issues/53661)
346
349
 
347
350
  Contribute your own gotchas to the [Wiki](https://github.com/grosser/parallel_tests/wiki) or even better open a PR :)
348
351
 
@@ -109,8 +109,19 @@ module ParallelTests
109
109
  end
110
110
 
111
111
  def run_tests(group, process_number, num_processes, options)
112
- if group.empty?
113
- { stdout: '', exit_status: 0, command: nil, seed: nil }
112
+ if (limit = options[:test_file_limit])
113
+ # TODO: will have some bugs with summarizing results and last process
114
+ results = group.each_slice(limit).map do |slice|
115
+ @runner.run_tests(slice, process_number, num_processes, options)
116
+ end
117
+ result = results[0]
118
+ results[1..].each do |res|
119
+ result[:stdout] = result[:stdout].to_s + res[:stdout].to_s
120
+ result[:exit_status] = [res[:exit_status], result[:exit_status]].max
121
+ # adding all files back in, not using original cmd to show what was actually run
122
+ result[:command] |= res[:command]
123
+ end
124
+ result
114
125
  else
115
126
  @runner.run_tests(group, process_number, num_processes, options)
116
127
  end
@@ -194,11 +205,11 @@ module ParallelTests
194
205
 
195
206
  Options are:
196
207
  BANNER
197
- opts.on("-n [PROCESSES]", Integer, "How many processes to use, default: available CPUs") { |n| options[:count] = n }
198
- opts.on("-p", "--pattern [PATTERN]", "run tests matching this regex pattern") { |pattern| options[:pattern] = /#{pattern}/ }
199
- opts.on("--exclude-pattern", "--exclude-pattern [PATTERN]", "exclude tests matching this regex pattern") { |pattern| options[:exclude_pattern] = /#{pattern}/ }
208
+ opts.on("-n PROCESSES", Integer, "How many processes to use, default: available CPUs") { |n| options[:count] = n }
209
+ opts.on("-p", "--pattern PATTERN", "run tests matching this regex pattern") { |pattern| options[:pattern] = /#{pattern}/ }
210
+ opts.on("--exclude-pattern", "--exclude-pattern PATTERN", "exclude tests matching this regex pattern") { |pattern| options[:exclude_pattern] = /#{pattern}/ }
200
211
  opts.on(
201
- "--group-by [TYPE]",
212
+ "--group-by TYPE",
202
213
  <<~TEXT.rstrip.split("\n").join("\n#{newline_padding}")
203
214
  group tests by:
204
215
  found - order of finding files
@@ -209,11 +220,11 @@ module ParallelTests
209
220
  default - runtime when runtime log is filled otherwise filesize
210
221
  TEXT
211
222
  ) { |type| options[:group_by] = type.to_sym }
212
- opts.on("-m [FLOAT]", "--multiply-processes [FLOAT]", Float, "use given number as a multiplier of processes to run") do |multiply|
223
+ opts.on("-m COUNT", "--multiply-processes COUNT", Float, "use given number as a multiplier of processes to run") do |multiply|
213
224
  options[:multiply] = multiply
214
225
  end
215
226
 
216
- opts.on("-s [PATTERN]", "--single [PATTERN]", "Run all matching files in the same process") do |pattern|
227
+ opts.on("-s PATTERN", "--single PATTERN", "Run all matching files in the same process") do |pattern|
217
228
  (options[:single_process] ||= []) << /#{pattern}/
218
229
  end
219
230
 
@@ -222,7 +233,7 @@ module ParallelTests
222
233
  end
223
234
 
224
235
  opts.on(
225
- "--isolate-n [PROCESSES]",
236
+ "--isolate-n PROCESSES",
226
237
  Integer,
227
238
  "Use 'isolate' singles with number of processes, default: 1"
228
239
  ) { |n| options[:isolate_count] = n }
@@ -233,13 +244,13 @@ module ParallelTests
233
244
  ) { options[:highest_exit_status] = true }
234
245
 
235
246
  opts.on(
236
- "--failure-exit-code [INT]",
247
+ "--failure-exit-code INT",
237
248
  Integer,
238
249
  "Specify the exit code to use when tests fail"
239
250
  ) { |code| options[:failure_exit_code] = code }
240
251
 
241
252
  opts.on(
242
- "--specify-groups [SPECS]",
253
+ "--specify-groups SPECS",
243
254
  <<~TEXT.rstrip.split("\n").join("\n#{newline_padding}")
244
255
  Use 'specify-groups' if you want to specify multiple specs running in multiple
245
256
  processes in a specific formation. Commas indicate specs in the same process,
@@ -253,7 +264,7 @@ module ParallelTests
253
264
  ) { |groups| options[:specify_groups] = groups }
254
265
 
255
266
  opts.on(
256
- "--only-group INT[,INT]",
267
+ "--only-group GROUP_INDEX[,GROUP_INDEX]",
257
268
  Array,
258
269
  <<~TEXT.rstrip.split("\n").join("\n#{newline_padding}")
259
270
  Only run the given group numbers.
@@ -261,16 +272,16 @@ module ParallelTests
261
272
  TEXT
262
273
  ) { |groups| options[:only_group] = groups.map(&:to_i) }
263
274
 
264
- opts.on("-e", "--exec [COMMAND]", "execute this code parallel and with ENV['TEST_ENV_NUMBER']") { |arg| options[:execute] = Shellwords.shellsplit(arg) }
265
- opts.on("-o", "--test-options '[OPTIONS]'", "execute test commands with those options") { |arg| options[:test_options] = Shellwords.shellsplit(arg) }
266
- opts.on("-t", "--type [TYPE]", "test(default) / rspec / cucumber / spinach") do |type|
275
+ opts.on("-e", "--exec COMMAND", "execute this code parallel and with ENV['TEST_ENV_NUMBER']") { |arg| options[:execute] = Shellwords.shellsplit(arg) }
276
+ opts.on("-o", "--test-options 'OPTIONS'", "execute test commands with those options") { |arg| options[:test_options] = Shellwords.shellsplit(arg) }
277
+ opts.on("-t", "--type TYPE", "test(default) / rspec / cucumber / spinach") do |type|
267
278
  @runner = load_runner(type)
268
279
  rescue NameError, LoadError => e
269
280
  puts "Runner for `#{type}` type has not been found! (#{e})"
270
281
  abort
271
282
  end
272
283
  opts.on(
273
- "--suffix [PATTERN]",
284
+ "--suffix PATTERN",
274
285
  <<~TEXT.rstrip.split("\n").join("\n#{newline_padding}")
275
286
  override built in test file pattern (should match suffix):
276
287
  '_spec.rb$' - matches rspec files
@@ -282,14 +293,15 @@ module ParallelTests
282
293
  opts.on("--combine-stderr", "Combine stderr into stdout, useful in conjunction with --serialize-stdout") { options[:combine_stderr] = true }
283
294
  opts.on("--non-parallel", "execute same commands but do not in parallel, needs --exec") { options[:non_parallel] = true }
284
295
  opts.on("--no-symlinks", "Do not traverse symbolic links to find test files") { options[:symlinks] = false }
285
- opts.on('--ignore-tags [PATTERN]', 'When counting steps ignore scenarios with tags that match this pattern') { |arg| options[:ignore_tag_pattern] = arg }
296
+ opts.on('--ignore-tags PATTERN', 'When counting steps ignore scenarios with tags that match this pattern') { |arg| options[:ignore_tag_pattern] = arg }
286
297
  opts.on("--nice", "execute test commands with low priority.") { options[:nice] = true }
287
- opts.on("--runtime-log [PATH]", "Location of previously recorded test runtimes") { |path| options[:runtime_log] = path }
288
- opts.on("--allowed-missing [INT]", Integer, "Allowed percentage of missing runtimes (default = 50)") { |percent| options[:allowed_missing_percent] = percent }
298
+ opts.on("--runtime-log PATH", "Location of previously recorded test runtimes") { |path| options[:runtime_log] = path }
299
+ opts.on("--allowed-missing COUNT", Integer, "Allowed percentage of missing runtimes (default = 50)") { |percent| options[:allowed_missing_percent] = percent }
289
300
  opts.on('--allow-duplicates', 'When detecting files to run, allow duplicates') { options[:allow_duplicates] = true }
290
- opts.on("--unknown-runtime [FLOAT]", Float, "Use given number as unknown runtime (otherwise use average time)") { |time| options[:unknown_runtime] = time }
301
+ opts.on("--unknown-runtime SECONDS", Float, "Use given number as unknown runtime (otherwise use average time)") { |time| options[:unknown_runtime] = time }
291
302
  opts.on("--first-is-1", "Use \"1\" as TEST_ENV_NUMBER to not reuse the default test environment") { options[:first_is_1] = true }
292
303
  opts.on("--fail-fast", "Stop all groups when one group fails (best used with --test-options '--fail-fast' if supported") { options[:fail_fast] = true }
304
+ opts.on("--test-file-limit LIMIT", Integer, "Limit to this number of files per test run by batching (for windows set to ~100 to stay below 8192 max command limit, might have bugs from reusing test-env-number and summarizing partial results)") { |limit| options[:test_file_limit] = limit }
293
305
  opts.on("--verbose", "Print debug output") { options[:verbose] = true }
294
306
  opts.on("--verbose-command", "Combines options --verbose-process-command and --verbose-rerun-command") { options.merge! verbose_process_command: true, verbose_rerun_command: true }
295
307
  opts.on("--verbose-process-command", "Print the command that will be executed by each process before it begins") { options[:verbose_process_command] = true }
@@ -25,6 +25,8 @@ class ParallelTests::RSpec::RuntimeLogger < ParallelTests::RSpec::LoggerBase
25
25
  super if defined?(super)
26
26
  end
27
27
 
28
+ def seed(*); end
29
+
28
30
  def dump_summary(*); end
29
31
 
30
32
  def dump_failures(*); end
@@ -15,7 +15,7 @@ module ParallelTests
15
15
  end
16
16
 
17
17
  def purge_before_load
18
- if Gem::Version.new(Rails.version) > Gem::Version.new('4.2.0')
18
+ if ActiveRecord.version > Gem::Version.new('4.2.0')
19
19
  Rake::Task.task_defined?('db:purge') ? 'db:purge' : 'app:db:purge'
20
20
  end
21
21
  end
@@ -90,7 +90,7 @@ module ParallelTests
90
90
  end
91
91
 
92
92
  def schema_format_based_on_rails_version
93
- if rails_7_or_greater?
93
+ if active_record_7_or_greater?
94
94
  ActiveRecord.schema_format
95
95
  else
96
96
  ActiveRecord::Base.schema_format
@@ -98,7 +98,7 @@ module ParallelTests
98
98
  end
99
99
 
100
100
  def schema_type_based_on_rails_version
101
- if rails_61_or_greater? || schema_format_based_on_rails_version == :ruby
101
+ if active_record_61_or_greater? || schema_format_based_on_rails_version == :ruby
102
102
  "schema"
103
103
  else
104
104
  "structure"
@@ -129,7 +129,7 @@ module ParallelTests
129
129
  end
130
130
 
131
131
  def configured_databases
132
- return [] unless defined?(ActiveRecord) && rails_61_or_greater?
132
+ return [] unless defined?(ActiveRecord) && active_record_61_or_greater?
133
133
 
134
134
  @@configured_databases ||= ActiveRecord::Tasks::DatabaseTasks.setup_initial_database_yaml
135
135
  end
@@ -148,12 +148,12 @@ module ParallelTests
148
148
 
149
149
  private
150
150
 
151
- def rails_7_or_greater?
152
- Gem::Version.new(Rails.version) >= Gem::Version.new('7.0')
151
+ def active_record_7_or_greater?
152
+ ActiveRecord.version >= Gem::Version.new('7.0')
153
153
  end
154
154
 
155
- def rails_61_or_greater?
156
- Gem::Version.new(Rails.version) >= Gem::Version.new('6.1.0')
155
+ def active_record_61_or_greater?
156
+ ActiveRecord.version >= Gem::Version.new('6.1.0')
157
157
  end
158
158
  end
159
159
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ParallelTests
3
- VERSION = '4.7.2'
3
+ VERSION = '4.9.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.7.2
4
+ version: 4.9.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-09-10 00:00:00.000000000 Z
11
+ date: 2025-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -69,10 +69,11 @@ licenses:
69
69
  - MIT
70
70
  metadata:
71
71
  bug_tracker_uri: https://github.com/grosser/parallel_tests/issues
72
- changelog_uri: https://github.com/grosser/parallel_tests/blob/v4.7.2/CHANGELOG.md
73
- documentation_uri: https://github.com/grosser/parallel_tests/blob/v4.7.2/Readme.md
74
- source_code_uri: https://github.com/grosser/parallel_tests/tree/v4.7.2
72
+ changelog_uri: https://github.com/grosser/parallel_tests/blob/v4.9.0/CHANGELOG.md
73
+ documentation_uri: https://github.com/grosser/parallel_tests/blob/v4.9.0/Readme.md
74
+ source_code_uri: https://github.com/grosser/parallel_tests/tree/v4.9.0
75
75
  wiki_uri: https://github.com/grosser/parallel_tests/wiki
76
+ rubygems_mfa_required: 'true'
76
77
  post_install_message:
77
78
  rdoc_options: []
78
79
  require_paths: