minitest-retry 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/stale.yml +28 -0
- data/.github/workflows/ubuntu.yml +2 -3
- data/CHANGELOG.md +8 -0
- data/Gemfile +1 -1
- data/README.md +3 -1
- data/bin/console +2 -6
- data/lib/minitest/retry/version.rb +1 -1
- data/lib/minitest/retry.rb +24 -7
- data/minitest-retry.gemspec +1 -0
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a31833391dfea9565ad1373bbf959f8e910fd618160a54be9ca641aebb68eda
|
4
|
+
data.tar.gz: 247aa4a9466e5f60484f68d865c34b7e61d2ba9a05cbea098e4a6be1eb6a772e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93abe11a1cdf89faf10f95f1cd1c1412696f77c5210d96b7ff2c160f6abc56d067e5324e7623216a28a32df649b11276c4a4f376126d21ab420ccac1a86a382c
|
7
|
+
data.tar.gz: 18487273718ca12691ecfd2cf791ecf9a5fa0366b0689a82b9eb9bc5213c0775fb365bbee06c8aa110bd09895d2028838987341d10e5b1de73e04251f6653429
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
|
2
|
+
#
|
3
|
+
# You can adjust the behavior by modifying this file.
|
4
|
+
# For more information, see:
|
5
|
+
# https://github.com/actions/stale
|
6
|
+
name: Mark stale issues and pull requests
|
7
|
+
|
8
|
+
on:
|
9
|
+
schedule:
|
10
|
+
- cron: '28 20 * * *'
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
stale:
|
14
|
+
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
permissions:
|
17
|
+
issues: write
|
18
|
+
pull-requests: write
|
19
|
+
|
20
|
+
steps:
|
21
|
+
- uses: actions/stale@v9
|
22
|
+
with:
|
23
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
24
|
+
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
|
25
|
+
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
|
26
|
+
stale-issue-label: 'no-issue-activity'
|
27
|
+
days-before-issue-stale: 30
|
28
|
+
days-before-issue-close: 5
|
@@ -7,15 +7,14 @@ jobs:
|
|
7
7
|
runs-on: ubuntu-latest
|
8
8
|
strategy:
|
9
9
|
matrix:
|
10
|
-
ruby: [ '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
|
-
- uses: actions/checkout@
|
12
|
+
- uses: actions/checkout@v4
|
13
13
|
- uses: ruby/setup-ruby@v1
|
14
14
|
with:
|
15
15
|
ruby-version: ${{ matrix.ruby }}
|
16
16
|
- name: Install dependencies
|
17
17
|
run: |
|
18
|
-
gem install bundler --no-document
|
19
18
|
bundle install
|
20
19
|
- name: Run test
|
21
20
|
run: bundle exec rake
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -38,7 +38,9 @@ Minitest::Retry.use!(
|
|
38
38
|
verbose: true, # Whether or not to display the message at the time of retry. The default is true.
|
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
|
-
methods_to_retry: []
|
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).
|
43
|
+
methods_to_skip: [] # List of methods that will skip a retry (when empty, all methods will retry).
|
42
44
|
)
|
43
45
|
```
|
44
46
|
|
data/bin/console
CHANGED
@@ -3,9 +3,5 @@
|
|
3
3
|
require "bundler/setup"
|
4
4
|
require "minitest/retry"
|
5
5
|
|
6
|
-
|
7
|
-
|
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__)
|
data/lib/minitest/retry.rb
CHANGED
@@ -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: [])
|
7
|
-
@retry_count, @io, @verbose, @exceptions_to_retry, @methods_to_retry = retry_count, io, verbose, exceptions_to_retry, methods_to_retry
|
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
|
8
8
|
@failure_callback, @consistent_failure_callback, @retry_callback = nil, nil, nil
|
9
9
|
Minitest.prepend(self)
|
10
10
|
end
|
@@ -44,6 +44,10 @@ module Minitest
|
|
44
44
|
@methods_to_retry
|
45
45
|
end
|
46
46
|
|
47
|
+
def classes_to_retry
|
48
|
+
@classes_to_retry
|
49
|
+
end
|
50
|
+
|
47
51
|
def failure_callback
|
48
52
|
@failure_callback
|
49
53
|
end
|
@@ -56,16 +60,29 @@ module Minitest
|
|
56
60
|
@retry_callback
|
57
61
|
end
|
58
62
|
|
59
|
-
def
|
63
|
+
def methods_to_skip
|
64
|
+
@methods_to_skip
|
65
|
+
end
|
66
|
+
|
67
|
+
def failure_to_retry?(failures = [], klass_method_name, klass)
|
60
68
|
return false if failures.empty?
|
61
69
|
|
62
70
|
if methods_to_retry.any?
|
63
71
|
return methods_to_retry.include?(klass_method_name)
|
64
72
|
end
|
65
73
|
|
66
|
-
|
67
|
-
|
68
|
-
|
74
|
+
if exceptions_to_retry.any?
|
75
|
+
errors = failures.map(&:error).map(&:class)
|
76
|
+
return (errors & exceptions_to_retry).any?
|
77
|
+
end
|
78
|
+
|
79
|
+
if methods_to_skip.any?
|
80
|
+
return !methods_to_skip.include?(klass_method_name)
|
81
|
+
end
|
82
|
+
|
83
|
+
return true if classes_to_retry.empty?
|
84
|
+
ancestors = klass.ancestors.map(&:to_s)
|
85
|
+
return classes_to_retry.any? { |class_to_retry| ancestors.include?(class_to_retry) }
|
69
86
|
end
|
70
87
|
end
|
71
88
|
|
@@ -74,7 +91,7 @@ module Minitest
|
|
74
91
|
result = super(klass, method_name)
|
75
92
|
|
76
93
|
klass_method_name = "#{klass.name}##{method_name}"
|
77
|
-
return result unless Minitest::Retry.failure_to_retry?(result.failures, klass_method_name)
|
94
|
+
return result unless Minitest::Retry.failure_to_retry?(result.failures, klass_method_name, klass)
|
78
95
|
if !result.skipped?
|
79
96
|
Minitest::Retry.failure_callback.call(klass, method_name, result) if Minitest::Retry.failure_callback
|
80
97
|
Minitest::Retry.retry_count.times do |count|
|
data/minitest-retry.gemspec
CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
17
|
# delete this section to allow pushing this gem to any host.
|
18
18
|
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
19
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
19
20
|
|
20
21
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
22
|
spec.bindir = "exe"
|
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.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Yaginuma
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-26 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: minitest
|
@@ -59,6 +58,7 @@ executables: []
|
|
59
58
|
extensions: []
|
60
59
|
extra_rdoc_files: []
|
61
60
|
files:
|
61
|
+
- ".github/workflows/stale.yml"
|
62
62
|
- ".github/workflows/ubuntu.yml"
|
63
63
|
- ".gitignore"
|
64
64
|
- CHANGELOG.md
|
@@ -76,7 +76,7 @@ licenses:
|
|
76
76
|
- MIT
|
77
77
|
metadata:
|
78
78
|
allowed_push_host: https://rubygems.org
|
79
|
-
|
79
|
+
rubygems_mfa_required: 'true'
|
80
80
|
rdoc_options: []
|
81
81
|
require_paths:
|
82
82
|
- lib
|
@@ -91,8 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
|
-
rubygems_version: 3.
|
95
|
-
signing_key:
|
94
|
+
rubygems_version: 3.6.2
|
96
95
|
specification_version: 4
|
97
96
|
summary: re-run the test when the test fails
|
98
97
|
test_files: []
|