minitest-retry 0.1.5 → 0.1.6
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/.travis.yml +4 -3
- data/CHANGELOG.md +6 -2
- data/README.md +4 -3
- data/lib/minitest/retry.rb +15 -3
- 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: 48f8d8974ffc3f3099a0edbbc4c7b3e6124c3084
|
4
|
+
data.tar.gz: a629409c0946a5c05bea0e24be1d8287ff7bbe32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8d3c814c37a137be4269cf092a4a363dcdd82597c563e127e948b8631c26804787f8c5bd2c4524707f154f499901f4ff01b8dbfc72acc42af5a5cfc830698d7
|
7
|
+
data.tar.gz: 8bd918699dbb207c4f100e98a8f508fb0b9f789ac4e2bf1d1b06331a552a0145edbdebe731fcf7545527a5a772a12edbed1ef801ff355b82348c3a01e5bf918d
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
+
## 0.1.6
|
2
|
+
|
3
|
+
* Add exceptions_to_retry option #13 [panjan]
|
4
|
+
|
1
5
|
## 0.1.5
|
2
6
|
|
3
|
-
* Improve message information when an unexpected error occurs [abarre]
|
7
|
+
* Improve message information when an unexpected error occurs #9 [abarre]
|
4
8
|
|
5
9
|
## 0.1.4
|
6
10
|
|
7
|
-
* Fix typo in verbose output [semanticart]
|
11
|
+
* Fix typo in verbose output #6 [semanticart]
|
8
12
|
|
9
13
|
## 0.1.3
|
10
14
|
|
data/README.md
CHANGED
@@ -34,9 +34,10 @@ Options can be specified to `use!` method. Can specify options are as follows:
|
|
34
34
|
|
35
35
|
```ruby
|
36
36
|
Minitest::Retry.use!(
|
37
|
-
retry_count: 3
|
38
|
-
verbose: true
|
39
|
-
io: $stdout
|
37
|
+
retry_count: 3, # The number of times to retry. The default is 3.
|
38
|
+
verbose: true, # Whether or not to display the message at the time of retry. The default is true.
|
39
|
+
io: $stdout, # Display destination of retry when the message. The default is stdout.
|
40
|
+
exceptions_to_retry: [] # List of exceptions that will trigger a retry (when empty, all exceptions will).
|
40
41
|
)
|
41
42
|
```
|
42
43
|
|
data/lib/minitest/retry.rb
CHANGED
@@ -2,8 +2,8 @@ require "minitest/retry/version"
|
|
2
2
|
|
3
3
|
module Minitest
|
4
4
|
module Retry
|
5
|
-
def self.use!(retry_count: 3, io: $stdout, verbose: true)
|
6
|
-
@retry_count, @io, @verbose = retry_count, io, verbose
|
5
|
+
def self.use!(retry_count: 3, io: $stdout, verbose: true, exceptions_to_retry: [])
|
6
|
+
@retry_count, @io, @verbose, @exceptions_to_retry = retry_count, io, verbose, exceptions_to_retry
|
7
7
|
Minitest.prepend(self)
|
8
8
|
end
|
9
9
|
|
@@ -19,11 +19,23 @@ module Minitest
|
|
19
19
|
@verbose
|
20
20
|
end
|
21
21
|
|
22
|
+
def self.exceptions_to_retry
|
23
|
+
@exceptions_to_retry
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.failure_to_retry?(failures = [])
|
27
|
+
return false if failures.empty?
|
28
|
+
return true if Minitest::Retry.exceptions_to_retry.empty?
|
29
|
+
errors = failures.map(&:error).map(&:class)
|
30
|
+
(errors & Minitest::Retry.exceptions_to_retry).any?
|
31
|
+
end
|
32
|
+
|
22
33
|
module ClassMethods
|
23
34
|
def run_one_method(klass, method_name)
|
24
35
|
retry_count = Minitest::Retry.retry_count
|
25
36
|
result = super(klass, method_name)
|
26
|
-
|
37
|
+
return result unless Minitest::Retry.failure_to_retry?(result.failures)
|
38
|
+
if !result.skipped?
|
27
39
|
retry_count.times do |count|
|
28
40
|
if Minitest::Retry.verbose && Minitest::Retry.io
|
29
41
|
msg = "[MinitestRetry] retry '%s' count: %s, msg: %s\n" %
|
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.6
|
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-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|