minitest-retry 0.2.3 → 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: 86e807cca8d36c1998d0f2b3bbb1413895a3e2e046e9fe55412e9f6f06e9a828
4
- data.tar.gz: b912521140c50f1d43a538d0482003deaf0b331aced6ac7a60c58bcc688e38ee
3
+ metadata.gz: 7d8360dd61c3f71e79586334e48d4eea9faaaf7a9c796b20c299615f9b6a38e9
4
+ data.tar.gz: 553974451059c548716c961245ee9698a18d9720db28a37d60ddf8def070e0dd
5
5
  SHA512:
6
- metadata.gz: 58c1c90c71ecde50576fae779b26934ea43f062163e3033cf115a74c48b62c20962a1536670a07dd3c0465b1212a859b4f22f04abd4fa2b2d05d7c79195061d9
7
- data.tar.gz: 00f0549faeccaff3be1be4ac788ecd0c32859f1a3888e4192fc017fdbf1efcd531bfa43e3a6ee92ff05932e8178b5feede6ed02486f2c66eec2fb1da479cc901
6
+ metadata.gz: e414e49f1c49c41c615ffea9c5950a2900c5036d2dfcd505a634d333544ef8f37c33318e6b12963abc2e0c5d0fc77635d59483f00a28b2ca6d14fd7a1bc786be
7
+ data.tar.gz: 0e39b05be22d6d7c2768a02dbce7c705b9dfc7cacdcdd5545bb023aa5bf76ed74a757954ab3634e84bbd2332852af9f9ff4eac0d9923ea05ad4543fe1be01f84
@@ -7,7 +7,7 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
  strategy:
9
9
  matrix:
10
- ruby: [ '3.3', '3.2', '3.1', '3.0', '2.7', '2.6', '2.5', '2.4', '2.3' ]
10
+ ruby: [ '3.4', '3.3', '3.2', '3.1', '3.0', '2.7', '2.6', '2.5', '2.4', '2.3' ]
11
11
  steps:
12
12
  - uses: actions/checkout@v4
13
13
  - uses: ruby/setup-ruby@v1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.2.5
2
+
3
+ * Add `exceptions_to_skip` option #48 [y-yagi]
4
+
5
+ ## 0.2.4
6
+
7
+ * Add `methods_to_skip` option #44 [y-yagi]
8
+
1
9
  ## 0.2.3
2
10
 
3
11
  * Add `classes_to_retry` option #42 [y-yagi]
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'pry'
3
+ gem 'debug'
4
4
  # Specify your gem's dependencies in minitest-retry.gemspec
5
5
  gemspec
data/README.md CHANGED
@@ -39,7 +39,9 @@ Minitest::Retry.use!(
39
39
  io: $stdout, # Display destination of retry when the message. The default is stdout.
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
- classes_to_retry: [] # List of classes that will trigger a retry (when empty, all classes will).
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).
44
+ exceptions_to_skip: [] # List of exceptions that will skip a retry (when empty, all exceptions will retry).
43
45
  )
44
46
  ```
45
47
 
data/bin/console CHANGED
@@ -3,9 +3,5 @@
3
3
  require "bundler/setup"
4
4
  require "minitest/retry"
5
5
 
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- require "pry"
11
- Pry.start
6
+ require "irb"
7
+ IRB.start(__FILE__)
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Retry
3
- VERSION = "0.2.3"
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: [])
7
- @retry_count, @io, @verbose, @exceptions_to_retry, @methods_to_retry, @classes_to_retry = retry_count, io, verbose, exceptions_to_retry, methods_to_retry, classes_to_retry
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
@@ -60,6 +60,14 @@ module Minitest
60
60
  @retry_callback
61
61
  end
62
62
 
63
+ def methods_to_skip
64
+ @methods_to_skip
65
+ end
66
+
67
+ def exceptions_to_skip
68
+ @exceptions_to_skip
69
+ end
70
+
63
71
  def failure_to_retry?(failures = [], klass_method_name, klass)
64
72
  return false if failures.empty?
65
73
 
@@ -72,6 +80,15 @@ module Minitest
72
80
  return (errors & exceptions_to_retry).any?
73
81
  end
74
82
 
83
+ if methods_to_skip.any?
84
+ return !methods_to_skip.include?(klass_method_name)
85
+ end
86
+
87
+ if exceptions_to_skip.any?
88
+ errors = failures.map(&:error).map(&:class)
89
+ return !(errors & exceptions_to_skip).any?
90
+ end
91
+
75
92
  return true if classes_to_retry.empty?
76
93
  ancestors = klass.ancestors.map(&:to_s)
77
94
  return classes_to_retry.any? { |class_to_retry| ancestors.include?(class_to_retry) }
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-retry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Yaginuma
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-09-15 00:00:00.000000000 Z
10
+ date: 2025-01-29 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: minitest
@@ -78,7 +77,6 @@ licenses:
78
77
  metadata:
79
78
  allowed_push_host: https://rubygems.org
80
79
  rubygems_mfa_required: 'true'
81
- post_install_message:
82
80
  rdoc_options: []
83
81
  require_paths:
84
82
  - lib
@@ -93,8 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
91
  - !ruby/object:Gem::Version
94
92
  version: '0'
95
93
  requirements: []
96
- rubygems_version: 3.5.11
97
- signing_key:
94
+ rubygems_version: 3.6.2
98
95
  specification_version: 4
99
96
  summary: re-run the test when the test fails
100
97
  test_files: []