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 +4 -4
- data/.github/workflows/ubuntu.yml +2 -2
- data/CHANGELOG.md +5 -1
- data/lib/minitest/retry/version.rb +1 -1
- data/lib/minitest/retry.rb +11 -12
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ef15ab34a100700a8fd0c7245ff9ebce03f33336dc967b717d615beaf1d885da
|
|
4
|
+
data.tar.gz: 6fec7805359af593b968e70afe3c755c9fed61b4e92290dcdcfa12feb0e11da5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
data/lib/minitest/retry.rb
CHANGED
|
@@ -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(
|
|
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
|
|
136
|
-
def run
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
144
|
+
result
|
|
142
145
|
end
|
|
143
146
|
end
|
|
144
147
|
|
|
145
148
|
def self.prepended(base)
|
|
146
|
-
|
|
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
|