parallel_tests 4.2.1 → 4.3.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: a9044c95c595a48f89a621563c609a4c9fa89d851792ca694a30fcaf947a2119
4
- data.tar.gz: 248e38e467b9070c1666819e2c1dc9149b791644b42e8a90cd53df82ebb80eed
3
+ metadata.gz: 598069c4031e361060ee4c4beaf7becc3454365b7825b7e9cb8d7909d2f0bb00
4
+ data.tar.gz: 3b0684f907eb1de6b9bb0556289ff3556052fc1fb75c138608801dbb91891b63
5
5
  SHA512:
6
- metadata.gz: 363e8d317a43d03043a270c19d05f60071bd05a9b435a0545454e81b96d875b694dd4fadc74669ba136990d57d863883132a19ff7fd1c9c4169e2c16a8e2db38
7
- data.tar.gz: ef251fa00adf1310c5281ee4985119ce6b4810d121d87a3a4a7f6b6a03aa968ed9be7847eec127e74a118983e4454b181635d1538b1a17b5f242fbb11839caa9
6
+ metadata.gz: 5056b01a89580b61ce8b49f034959fe7f5b08f7dee2bd83cd44c115016483ff1be41f1ca34b3cc8471ef9e4ce898b9d3cb3b5123cf88905a9d9c21e6a08439b5
7
+ data.tar.gz: 91a0afb5012fc117de3f602b769d590be185e322dab9555c1f9eae220d90db7131d7516e8fd338ec25cbd8c70428209e5b85b644380f00722eaafd5d41ac9f36
data/Readme.md CHANGED
@@ -3,8 +3,8 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/parallel_tests.svg)](https://rubygems.org/gems/parallel_tests)
4
4
  [![Build status](https://github.com/grosser/parallel_tests/workflows/test/badge.svg)](https://github.com/grosser/parallel_tests/actions?query=workflow%3Atest)
5
5
 
6
- Speedup Test::Unit + RSpec + Cucumber + Spinach by running parallel on multiple CPU cores.<br/>
7
- ParallelTests splits tests into even groups (by number of lines or runtime) and runs each group in a single process with its own database.
6
+ Speedup Minitest + RSpec + Turnip + Cucumber + Spinach by running parallel on multiple CPU cores.<br/>
7
+ ParallelTests splits tests into balanced groups (by number of lines or runtime) and runs each group in a process with its own database.
8
8
 
9
9
  Setup for Rails
10
10
  ===============
@@ -46,7 +46,7 @@ test:
46
46
  rake parallel:drop
47
47
 
48
48
  ### Run!
49
- rake parallel:test # Test::Unit
49
+ rake parallel:test # Minitest
50
50
  rake parallel:spec # RSpec
51
51
  rake parallel:features # Cucumber
52
52
  rake parallel:features-spinach # Spinach
@@ -228,7 +228,9 @@ Options are:
228
228
  Process 1 will contain 1_spec.rb and 2_spec.rb
229
229
  Process 2 will contain 3_spec.rb
230
230
  Process 3 will contain all other specs
231
- --only-group INT[,INT]
231
+ --only-group INT[,INT] Only run the given group numbers. Note that this will force the 'filesize'
232
+ grouping strategy (even when the runtime log is present) unless you explicitly
233
+ set it otherwise via the '-group-by' flag.
232
234
  -e, --exec [COMMAND] execute this code parallel and with ENV['TEST_ENV_NUMBER']
233
235
  -o, --test-options '[OPTIONS]' execute test commands with those options
234
236
  -t, --type [TYPE] test(default) / rspec / cucumber / spinach
@@ -244,7 +244,14 @@ module ParallelTests
244
244
  TEXT
245
245
  ) { |groups| options[:specify_groups] = groups }
246
246
 
247
- opts.on("--only-group INT[,INT]", Array) { |groups| options[:only_group] = groups.map(&:to_i) }
247
+ opts.on(
248
+ "--only-group INT[,INT]",
249
+ Array,
250
+ <<~TEXT.rstrip.split("\n").join("\n#{newline_padding}")
251
+ Only run the given group numbers.
252
+ Changes `--group-by` default to 'filesize'.
253
+ TEXT
254
+ ) { |groups| options[:only_group] = groups.map(&:to_i) }
248
255
 
249
256
  opts.on("-e", "--exec [COMMAND]", "execute this code parallel and with ENV['TEST_ENV_NUMBER']") { |arg| options[:execute] = Shellwords.shellsplit(arg) }
250
257
  opts.on("-o", "--test-options '[OPTIONS]'", "execute test commands with those options") { |arg| options[:test_options] = Shellwords.shellsplit(arg) }
@@ -258,7 +265,7 @@ module ParallelTests
258
265
  "--suffix [PATTERN]",
259
266
  <<~TEXT.rstrip.split("\n").join("\n#{newline_padding}")
260
267
  override built in test file pattern (should match suffix):
261
- '_spec\.rb$' - matches rspec files
268
+ '_spec.rb$' - matches rspec files
262
269
  '_(test|spec).rb$' - matches test or spec files
263
270
  TEXT
264
271
  ) { |pattern| options[:suffix] = /#{pattern}/ }
@@ -3,22 +3,14 @@ require 'parallel_tests/rspec/logger_base'
3
3
  require 'parallel_tests/rspec/runner'
4
4
 
5
5
  class ParallelTests::RSpec::FailuresLogger < ParallelTests::RSpec::LoggerBase
6
- if RSPEC_2
7
- def dump_failures(*args); end
8
- else
9
- RSpec::Core::Formatters.register self, :dump_summary
10
- end
6
+ RSpec::Core::Formatters.register(self, :dump_summary)
11
7
 
12
8
  def dump_summary(*args)
13
9
  lock_output do
14
- if RSPEC_2
15
- dump_commands_to_rerun_failed_examples
16
- else
17
- notification = args.first
18
- unless notification.failed_examples.empty?
19
- colorizer = ::RSpec::Core::Formatters::ConsoleCodes
20
- output.puts notification.colorized_rerun_commands(colorizer)
21
- end
10
+ notification = args.first
11
+ unless notification.failed_examples.empty?
12
+ colorizer = ::RSpec::Core::Formatters::ConsoleCodes
13
+ output.puts notification.colorized_rerun_commands(colorizer)
22
14
  end
23
15
  end
24
16
  @output.flush
@@ -7,8 +7,6 @@ end
7
7
  require 'rspec/core/formatters/base_text_formatter'
8
8
 
9
9
  class ParallelTests::RSpec::LoggerBase < RSpec::Core::Formatters::BaseTextFormatter
10
- RSPEC_2 = RSpec::Core::Version::STRING.start_with?('2')
11
-
12
10
  def initialize(*args)
13
11
  super
14
12
 
@@ -33,8 +33,10 @@ module ParallelTests
33
33
  "spec"
34
34
  end
35
35
 
36
+ # used to find all _spec.rb files
37
+ # supports also feature files used by rspec turnip extension
36
38
  def test_suffix
37
- /_spec\.rb$/
39
+ /(_spec\.rb|\.feature)$/
38
40
  end
39
41
 
40
42
  def line_is_result?(line)
@@ -9,7 +9,7 @@ class ParallelTests::RSpec::RuntimeLogger < ParallelTests::RSpec::LoggerBase
9
9
  @group_nesting = 0
10
10
  end
11
11
 
12
- RSpec::Core::Formatters.register self, :example_group_started, :example_group_finished, :start_dump unless RSPEC_2
12
+ RSpec::Core::Formatters.register(self, :example_group_started, :example_group_finished, :start_dump)
13
13
 
14
14
  def example_group_started(example_group)
15
15
  @time = ParallelTests.now if @group_nesting == 0
@@ -20,8 +20,7 @@ class ParallelTests::RSpec::RuntimeLogger < ParallelTests::RSpec::LoggerBase
20
20
  def example_group_finished(notification)
21
21
  @group_nesting -= 1
22
22
  if @group_nesting == 0
23
- path = (RSPEC_2 ? notification.file_path : notification.group.file_path)
24
- @example_times[path] += ParallelTests.now - @time
23
+ @example_times[notification.group.file_path] += ParallelTests.now - @time
25
24
  end
26
25
  super if defined?(super)
27
26
  end
@@ -39,7 +38,7 @@ class ParallelTests::RSpec::RuntimeLogger < ParallelTests::RSpec::LoggerBase
39
38
  lock_output do
40
39
  @example_times.each do |file, time|
41
40
  relative_path = file.sub(%r{^#{Regexp.escape Dir.pwd}/}, '').sub(%r{^\./}, "")
42
- @output.puts "#{relative_path}:#{time > 0 ? time : 0}"
41
+ @output.puts "#{relative_path}:#{[time, 0].max}"
43
42
  end
44
43
  end
45
44
  @output.flush
@@ -2,7 +2,7 @@
2
2
  require 'parallel_tests/rspec/failures_logger'
3
3
 
4
4
  class ParallelTests::RSpec::SummaryLogger < ParallelTests::RSpec::LoggerBase
5
- RSpec::Core::Formatters.register self, :dump_failures unless RSPEC_2
5
+ RSpec::Core::Formatters.register(self, :dump_failures)
6
6
 
7
7
  def dump_failures(*args)
8
8
  lock_output { super }
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ParallelTests
3
- VERSION = '4.2.1'
3
+ VERSION = '4.3.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.2.1
4
+ version: 4.3.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: 2023-05-12 00:00:00.000000000 Z
11
+ date: 2023-10-09 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/v4.2.1/Readme.md
72
- source_code_uri: https://github.com/grosser/parallel_tests/tree/v4.2.1
71
+ documentation_uri: https://github.com/grosser/parallel_tests/blob/v4.3.0/Readme.md
72
+ source_code_uri: https://github.com/grosser/parallel_tests/tree/v4.3.0
73
73
  wiki_uri: https://github.com/grosser/parallel_tests/wiki
74
74
  post_install_message:
75
75
  rdoc_options: []