minitest-retry 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +8 -0
- data/Rakefile +1 -0
- data/lib/minitest/retry.rb +12 -2
- data/lib/minitest/retry/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adef2404a03df16664a61e705b7a6217e37c50e3
|
4
|
+
data.tar.gz: ff508f9eba54c0421a2b0dd69f0e2169e84fd87f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0207ff184998ffcaf7043f23e0ff3a240fa3c7f630fe6e4ce81c6657d548a132bd1177708acaf6b059dc150dc1ca8da8d74df3790b4567c2dfe8ad82cffdbe5a
|
7
|
+
data.tar.gz: b7228bf144afa0e1041694da7fcbf0898ca88383b708407344cba49f124dbea6f4aec1ac3ad4c15acdaf975b83ff35c06db850fb68cbc7580c1a09185dcd2822
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/lib/minitest/retry.rb
CHANGED
@@ -4,9 +4,15 @@ module Minitest
|
|
4
4
|
module Retry
|
5
5
|
def self.use!(retry_count: 3, io: $stdout, verbose: true, exceptions_to_retry: [])
|
6
6
|
@retry_count, @io, @verbose, @exceptions_to_retry = retry_count, io, verbose, exceptions_to_retry
|
7
|
+
@failure_callback = nil
|
7
8
|
Minitest.prepend(self)
|
8
9
|
end
|
9
10
|
|
11
|
+
def self.on_failure(&block)
|
12
|
+
return unless block_given?
|
13
|
+
@failure_callback = block
|
14
|
+
end
|
15
|
+
|
10
16
|
def self.retry_count
|
11
17
|
@retry_count
|
12
18
|
end
|
@@ -23,6 +29,10 @@ module Minitest
|
|
23
29
|
@exceptions_to_retry
|
24
30
|
end
|
25
31
|
|
32
|
+
def self.failure_callback
|
33
|
+
@failure_callback
|
34
|
+
end
|
35
|
+
|
26
36
|
def self.failure_to_retry?(failures = [])
|
27
37
|
return false if failures.empty?
|
28
38
|
return true if Minitest::Retry.exceptions_to_retry.empty?
|
@@ -32,11 +42,11 @@ module Minitest
|
|
32
42
|
|
33
43
|
module ClassMethods
|
34
44
|
def run_one_method(klass, method_name)
|
35
|
-
retry_count = Minitest::Retry.retry_count
|
36
45
|
result = super(klass, method_name)
|
37
46
|
return result unless Minitest::Retry.failure_to_retry?(result.failures)
|
38
47
|
if !result.skipped?
|
39
|
-
|
48
|
+
Minitest::Retry.failure_callback.call if Minitest::Retry.failure_callback
|
49
|
+
Minitest::Retry.retry_count.times do |count|
|
40
50
|
if Minitest::Retry.verbose && Minitest::Retry.io
|
41
51
|
msg = "[MinitestRetry] retry '%s' count: %s, msg: %s\n" %
|
42
52
|
[method_name, count + 1, result.failures.map(&:message).join(",")]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-retry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Yaginuma
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|