parallel_tests 4.5.2 → 4.6.1

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: 45b8232e3e41cd559e94530f55ca9cf0b8336eebc563a370b0c2b20688aabcb2
4
- data.tar.gz: 40208b56455ad6bd4498c3b8e75c20b27fb813f1ac192130ddf12570c240a7b4
3
+ metadata.gz: a00430ce92cb7dbfe80737cb601f269f463d60cdf6652e8932398bce2386dc2b
4
+ data.tar.gz: 8638d842e945665c779e433b40b70775719a30839dc0a59476d1e7987df5ef1e
5
5
  SHA512:
6
- metadata.gz: 9019208e52a23c231d85b24e05b06eca84a0337303fdd2922d5d465217210df25768f72300ba54c30ab2768af741617af6ec734fa51c78858837f93a8277f46d
7
- data.tar.gz: 75003af6f40dad1c00eb208e9f0c9a24bc6cec3b06e95dc54b18e0b9dc59cbfe6ee817214b23a67b4bc23a0a0a7f8966d1f0950877a0f13306939a0cca155e3c
6
+ metadata.gz: b6ced0d1c0d23f42c14992977493f3712d8b60c6a0a933b2b0cfcd1ba413119dbe3084853f6915471946535e26399b0132fa8f7520bb002131941da09553eb6c
7
+ data.tar.gz: 5d2d5a3d8b400e337345a0e0e13ae5e94a4a1a8a4c5ef6fa3132091c1d8f66f6dabddda1dd0f9f880adade03345d9fc84bed44a7b22432490e759094b8b77d9d
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
 
@@ -279,6 +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
283
  --unknown-runtime [FLOAT] Use given number as unknown runtime (otherwise use average time)
283
284
  --first-is-1 Use "1" as TEST_ENV_NUMBER to not reuse the default test environment
284
285
  --fail-fast Stop all groups when one group fails (best used with --test-options '--fail-fast' if supported
@@ -438,6 +439,7 @@ inspired by [pivotal labs](https://blog.pivotal.io/labs/labs/parallelize-your-rs
438
439
  - [Eric Kessler](https://github.com/enkessler)
439
440
  - [Adis Osmonov](https://github.com/adis-io)
440
441
  - [Josh Westbrook](https://github.com/joshwestbrook)
442
+ - [Jay Dorsey](https://github.com/jaydorsey)
441
443
 
442
444
  [Michael Grosser](http://grosser.it)<br/>
443
445
  michael@grosser.it<br/>
@@ -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
@@ -278,6 +278,7 @@ module ParallelTests
278
278
  opts.on("--nice", "execute test commands with low priority.") { options[:nice] = true }
279
279
  opts.on("--runtime-log [PATH]", "Location of previously recorded test runtimes") { |path| options[:runtime_log] = path }
280
280
  opts.on("--allowed-missing [INT]", Integer, "Allowed percentage of missing runtimes (default = 50)") { |percent| options[:allowed_missing_percent] = percent }
281
+ opts.on('--allow-duplicates', 'When detecting files to run, allow duplicates') { options[:allow_duplicates] = true }
281
282
  opts.on("--unknown-runtime [FLOAT]", Float, "Use given number as unknown runtime (otherwise use average time)") { |time| options[:unknown_runtime] = time }
282
283
  opts.on("--first-is-1", "Use \"1\" as TEST_ENV_NUMBER to not reuse the default test environment") { options[:first_is_1] = true }
283
284
  opts.on("--fail-fast", "Stop all groups when one group fails (best used with --test-options '--fail-fast' if supported") { options[:fail_fast] = true }
@@ -238,8 +238,9 @@ module ParallelTests
238
238
  suffix_pattern = options[:suffix] || test_suffix
239
239
  include_pattern = options[:pattern] || //
240
240
  exclude_pattern = options[:exclude_pattern]
241
+ allow_duplicates = options[:allow_duplicates]
241
242
 
242
- (tests || []).flat_map do |file_or_folder|
243
+ files = (tests || []).flat_map do |file_or_folder|
243
244
  if File.directory?(file_or_folder)
244
245
  files = files_in_folder(file_or_folder, options)
245
246
  files = files.grep(suffix_pattern).grep(include_pattern)
@@ -248,7 +249,9 @@ module ParallelTests
248
249
  else
249
250
  file_or_folder
250
251
  end
251
- end.uniq
252
+ end
253
+
254
+ allow_duplicates ? files : files.uniq
252
255
  end
253
256
 
254
257
  def files_in_folder(folder, options = {})
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ParallelTests
3
- VERSION = '4.5.2'
3
+ VERSION = '4.6.1'
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.5.2
4
+ version: 4.6.1
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-05 00:00:00.000000000 Z
11
+ date: 2024-04-03 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.5.2/Readme.md
73
- source_code_uri: https://github.com/grosser/parallel_tests/tree/v4.5.2
72
+ documentation_uri: https://github.com/grosser/parallel_tests/blob/v4.6.1/Readme.md
73
+ source_code_uri: https://github.com/grosser/parallel_tests/tree/v4.6.1
74
74
  wiki_uri: https://github.com/grosser/parallel_tests/wiki
75
75
  post_install_message:
76
76
  rdoc_options: []