minitest-retry 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a31833391dfea9565ad1373bbf959f8e910fd618160a54be9ca641aebb68eda
4
- data.tar.gz: 247aa4a9466e5f60484f68d865c34b7e61d2ba9a05cbea098e4a6be1eb6a772e
3
+ metadata.gz: 7d8360dd61c3f71e79586334e48d4eea9faaaf7a9c796b20c299615f9b6a38e9
4
+ data.tar.gz: 553974451059c548716c961245ee9698a18d9720db28a37d60ddf8def070e0dd
5
5
  SHA512:
6
- metadata.gz: 93abe11a1cdf89faf10f95f1cd1c1412696f77c5210d96b7ff2c160f6abc56d067e5324e7623216a28a32df649b11276c4a4f376126d21ab420ccac1a86a382c
7
- data.tar.gz: 18487273718ca12691ecfd2cf791ecf9a5fa0366b0689a82b9eb9bc5213c0775fb365bbee06c8aa110bd09895d2028838987341d10e5b1de73e04251f6653429
6
+ metadata.gz: e414e49f1c49c41c615ffea9c5950a2900c5036d2dfcd505a634d333544ef8f37c33318e6b12963abc2e0c5d0fc77635d59483f00a28b2ca6d14fd7a1bc786be
7
+ data.tar.gz: 0e39b05be22d6d7c2768a02dbce7c705b9dfc7cacdcdd5545bb023aa5bf76ed74a757954ab3634e84bbd2332852af9f9ff4eac0d9923ea05ad4543fe1be01f84
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.5
2
+
3
+ * Add `exceptions_to_skip` option #48 [y-yagi]
4
+
1
5
  ## 0.2.4
2
6
 
3
7
  * Add `methods_to_skip` option #44 [y-yagi]
data/README.md CHANGED
@@ -40,7 +40,8 @@ Minitest::Retry.use!(
40
40
  exceptions_to_retry: [], # List of exceptions that will trigger a retry (when empty, all exceptions will).
41
41
  methods_to_retry: [], # List of methods that will trigger a retry (when empty, all methods will).
42
42
  classes_to_retry: [], # List of classes that will trigger a retry (when empty, all classes will).
43
- methods_to_skip: [] # List of methods that will skip a retry (when empty, all methods will retry).
43
+ methods_to_skip: [], # List of methods that will skip a retry (when empty, all methods will retry).
44
+ exceptions_to_skip: [] # List of exceptions that will skip a retry (when empty, all exceptions will retry).
44
45
  )
45
46
  ```
46
47
 
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Retry
3
- VERSION = "0.2.4"
3
+ VERSION = "0.2.5"
4
4
  end
5
5
  end
@@ -3,8 +3,8 @@ require "minitest/retry/version"
3
3
  module Minitest
4
4
  module Retry
5
5
  class << self
6
- def use!(retry_count: 3, io: $stdout, verbose: true, exceptions_to_retry: [], methods_to_retry: [], classes_to_retry: [], methods_to_skip: [])
7
- @retry_count, @io, @verbose, @exceptions_to_retry, @methods_to_retry, @classes_to_retry, @methods_to_skip = retry_count, io, verbose, exceptions_to_retry, methods_to_retry, classes_to_retry, methods_to_skip
6
+ def use!(retry_count: 3, io: $stdout, verbose: true, exceptions_to_retry: [], methods_to_retry: [], classes_to_retry: [], methods_to_skip: [], exceptions_to_skip: [])
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
10
  end
@@ -64,6 +64,10 @@ module Minitest
64
64
  @methods_to_skip
65
65
  end
66
66
 
67
+ def exceptions_to_skip
68
+ @exceptions_to_skip
69
+ end
70
+
67
71
  def failure_to_retry?(failures = [], klass_method_name, klass)
68
72
  return false if failures.empty?
69
73
 
@@ -80,6 +84,11 @@ module Minitest
80
84
  return !methods_to_skip.include?(klass_method_name)
81
85
  end
82
86
 
87
+ if exceptions_to_skip.any?
88
+ errors = failures.map(&:error).map(&:class)
89
+ return !(errors & exceptions_to_skip).any?
90
+ end
91
+
83
92
  return true if classes_to_retry.empty?
84
93
  ancestors = klass.ancestors.map(&:to_s)
85
94
  return classes_to_retry.any? { |class_to_retry| ancestors.include?(class_to_retry) }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-retry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Yaginuma
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-26 00:00:00.000000000 Z
10
+ date: 2025-01-29 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: minitest