minitest-retry 0.3.0 → 0.3.1

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: e8d4d665c0afb4fe2ae9548c66ef1a7beb4158615b0d0f8e9ae193124b6c3c50
4
- data.tar.gz: b475f7d149b3d6365ae8718884ea830cdf561a0c09e1e4b01eee5e82bb23c71d
3
+ metadata.gz: ef15ab34a100700a8fd0c7245ff9ebce03f33336dc967b717d615beaf1d885da
4
+ data.tar.gz: 6fec7805359af593b968e70afe3c755c9fed61b4e92290dcdcfa12feb0e11da5
5
5
  SHA512:
6
- metadata.gz: 282ba68c650f2062afcd0acf9ac0fffab2c2fc5eed52744e24f87495edc8ea8624825e3bbb8e6d3869512481ed1932874af1ddb1cb5c0b7c0458393965014ebf
7
- data.tar.gz: 87a04ad51d02b17181ca6c40b38c25c604de260222358a6ffcfba9d2757e4d3843939d140179e8825c28a4c1f4809cbceec381e8f5d4d8449d5fe48ef3cf9a0a
6
+ metadata.gz: d17edb63d1bc7171b701b502fa44c88b00c2f4a7c1a7bd03c312a0ba1ca679d1db558e91209fcde13f19f2d9f9323cac1346f470731855e2980ae65c51cbe55d
7
+ data.tar.gz: cdbe3f5e4e7061a5c68972f45a537764e46b410b815925e3a606b40939927044a69cc45499d1e8f5d73d333d8284600678b382e2a0dd652fc6b4c716dfaf739b
@@ -7,7 +7,7 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
  strategy:
9
9
  matrix:
10
- ruby: [ '3.4', '3.3', '3.2', '3.1', '3.0', '2.7', '2.6', '2.5', '2.4', '2.3' ]
10
+ ruby: [ '4.0', '3.4', '3.3', '3.2', '3.1', '3.0', '2.7', '2.6', '2.5', '2.4', '2.3' ]
11
11
  env:
12
12
  BUNDLE_GEMFILE: gemfiles/minitest_5.gemfile
13
13
  steps:
@@ -24,7 +24,7 @@ jobs:
24
24
  runs-on: ubuntu-latest
25
25
  strategy:
26
26
  matrix:
27
- ruby: [ '3.4', '3.3', '3.2' ]
27
+ ruby: [ '4.0', '3.4', '3.3', '3.2' ]
28
28
  env:
29
29
  BUNDLE_GEMFILE: gemfiles/minitest_6.gemfile
30
30
  steps:
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
+ ## 0.3.1
2
+
3
+ * Fix a bug where tests were not retried during parallel execution with minitest 6#54 [y-yagi]
4
+
1
5
  ## 0.3.0
2
6
 
3
- * Support minitest 6 [y-yagi]
7
+ * Support minitest v6 #50 [y-yagi]
4
8
 
5
9
  ## 0.2.5
6
10
 
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Retry
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
@@ -7,6 +7,7 @@ module Minitest
7
7
  @retry_count, @io, @verbose, @exceptions_to_retry, @methods_to_retry, @classes_to_retry, @methods_to_skip, @exceptions_to_skip = retry_count, io, verbose, exceptions_to_retry, methods_to_retry, classes_to_retry, methods_to_skip, exceptions_to_skip
8
8
  @failure_callback, @consistent_failure_callback, @retry_callback = nil, nil, nil
9
9
  Minitest.prepend(self)
10
+ Minitest::Test.prepend(TestWithRetry) if Minitest::VERSION > "6"
10
11
  end
11
12
 
12
13
  def on_failure(&block)
@@ -94,7 +95,8 @@ module Minitest
94
95
  return classes_to_retry.any? { |class_to_retry| ancestors.include?(class_to_retry) }
95
96
  end
96
97
 
97
- def run_with_retry(klass, method_name)
98
+ def run_with_retry(klass_or_instance, method_name)
99
+ klass = klass_or_instance.instance_of?(Class) ? klass_or_instance : klass_or_instance.class
98
100
  klass_method_name = "#{klass.name}##{method_name}"
99
101
  result = yield
100
102
 
@@ -112,6 +114,8 @@ module Minitest
112
114
  io.puts(msg)
113
115
  end
114
116
 
117
+ # NOTE: Only keep the last result when executed multiple times.
118
+ klass_or_instance.failures.clear if klass_or_instance.respond_to?(:failures)
115
119
  result = yield
116
120
  break if result.failures.empty?
117
121
  end
@@ -132,22 +136,17 @@ module Minitest
132
136
  end
133
137
  end
134
138
 
135
- module RunnableMethods
136
- def run(klass, method_name, reporter)
137
- reporter.prerecord klass, method_name
138
- result = Minitest::Retry.run_with_retry(klass, method_name) do
139
- klass.new(method_name).run
139
+ module TestWithRetry
140
+ def run
141
+ result = Minitest::Retry.run_with_retry(self, self.name) do
142
+ super
140
143
  end
141
- reporter.record result
144
+ result
142
145
  end
143
146
  end
144
147
 
145
148
  def self.prepended(base)
146
- if Minitest::VERSION > "6"
147
- class << Minitest::Runnable
148
- prepend RunnableMethods
149
- end
150
- else
149
+ unless Minitest::VERSION > "6"
151
150
  class << base
152
151
  prepend ClassMethods
153
152
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-retry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Yaginuma