minitest-retry 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/CHANGELOG.md +4 -0
- data/README.md +8 -2
- data/lib/minitest/retry.rb +14 -1
- data/lib/minitest/retry/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecca356b18b220ceac0b267626245edd50f7b343
|
4
|
+
data.tar.gz: 8fbc8b15e2b12c988c9a4855b2e13a2105db629d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 170bc39e8133e8e6099467d2689fc96d17bf50faa1adbd95bc4044d4537562041dbe3570972e579106ea3506504b626c3a85dde7343915c63797a8f734799111
|
7
|
+
data.tar.gz: d89bdfaf9cddecd3ec8e426bc8fdcd2409bcdbe5162fb993ad269be8a02a405b6bfdc4f3b22d5c3838498c699caa295466f60d18523ebcfd2eb12dc0996508cb
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -49,13 +49,19 @@ Minitest::Retry.on_failure do |klass, test_name|
|
|
49
49
|
end
|
50
50
|
```
|
51
51
|
|
52
|
+
The `on_consistent_failure` callback is executed whan a test consistently fails:
|
53
|
+
```ruby
|
54
|
+
Minitest::Retry.on_consistent_failure do |klass, test_name|
|
55
|
+
# code omitted
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
52
59
|
The `on_retry` callback is executed each time a test is retried:
|
53
60
|
```ruby
|
54
61
|
Minitest::Retry.on_retry do |klass, test_name, retry_count|
|
55
62
|
# code omitted
|
56
63
|
end
|
57
|
-
|
58
|
-
|
64
|
+
```
|
59
65
|
|
60
66
|
## Example
|
61
67
|
|
data/lib/minitest/retry.rb
CHANGED
@@ -5,7 +5,7 @@ module Minitest
|
|
5
5
|
class << self
|
6
6
|
def use!(retry_count: 3, io: $stdout, verbose: true, exceptions_to_retry: [])
|
7
7
|
@retry_count, @io, @verbose, @exceptions_to_retry = retry_count, io, verbose, exceptions_to_retry
|
8
|
-
@failure_callback, @retry_callback = nil, nil
|
8
|
+
@failure_callback, @consistent_failure_callback, @retry_callback = nil, nil, nil
|
9
9
|
Minitest.prepend(self)
|
10
10
|
end
|
11
11
|
|
@@ -14,6 +14,11 @@ module Minitest
|
|
14
14
|
@failure_callback = block
|
15
15
|
end
|
16
16
|
|
17
|
+
def on_consistent_failure(&block)
|
18
|
+
return unless block_given?
|
19
|
+
@consistent_failure_callback = block
|
20
|
+
end
|
21
|
+
|
17
22
|
def on_retry(&block)
|
18
23
|
return unless block_given?
|
19
24
|
@retry_callback = block
|
@@ -39,6 +44,10 @@ module Minitest
|
|
39
44
|
@failure_callback
|
40
45
|
end
|
41
46
|
|
47
|
+
def consistent_failure_callback
|
48
|
+
@consistent_failure_callback
|
49
|
+
end
|
50
|
+
|
42
51
|
def retry_callback
|
43
52
|
@retry_callback
|
44
53
|
end
|
@@ -68,6 +77,10 @@ module Minitest
|
|
68
77
|
result = super(klass, method_name)
|
69
78
|
break if result.failures.empty?
|
70
79
|
end
|
80
|
+
|
81
|
+
if Minitest::Retry.consistent_failure_callback && !result.failures.empty?
|
82
|
+
Minitest::Retry.consistent_failure_callback.call(klass, method_name)
|
83
|
+
end
|
71
84
|
end
|
72
85
|
result
|
73
86
|
end
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Yaginuma
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.6.
|
95
|
+
rubygems_version: 2.6.12
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: re-run the test when the test fails
|