minitest-retry 0.2.2 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 986ef3b3ffb779d7f4351d864c93d932226cbef9653fa7f5bc208502f46586b2
4
- data.tar.gz: 5e0a10b926b1aa02e08289c017379b68a4b6741dd5572e66ed5fb7aaba5a9d66
3
+ metadata.gz: 86e807cca8d36c1998d0f2b3bbb1413895a3e2e046e9fe55412e9f6f06e9a828
4
+ data.tar.gz: b912521140c50f1d43a538d0482003deaf0b331aced6ac7a60c58bcc688e38ee
5
5
  SHA512:
6
- metadata.gz: 800c226cf0c6f93553db2e2e242a46fbddcd6f048c2c266db7c4ceec0ab50186601e46e858ac512d3075aead1c23e79067ee887f1552fe3bb12275d097f1cb43
7
- data.tar.gz: eb564f112cad335895e657924e437240db612dd1d2afde35f2da2d30aeed5ed25805641287ba69a93ec996a31563630ba6acdb7f4ff837029c1ac361dfe8cf0a
6
+ metadata.gz: 58c1c90c71ecde50576fae779b26934ea43f062163e3033cf115a74c48b62c20962a1536670a07dd3c0465b1212a859b4f22f04abd4fa2b2d05d7c79195061d9
7
+ data.tar.gz: 00f0549faeccaff3be1be4ac788ecd0c32859f1a3888e4192fc017fdbf1efcd531bfa43e3a6ee92ff05932e8178b5feede6ed02486f2c66eec2fb1da479cc901
@@ -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.3', '3.2', '3.1', '3.0', '2.7', '2.6', '2.5', '2.4', '2.3' ]
11
11
  steps:
12
- - uses: actions/checkout@v2
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
@@ -1,3 +1,7 @@
1
+ ## 0.2.3
2
+
3
+ * Add `classes_to_retry` option #42 [y-yagi]
4
+
1
5
  ## 0.2.2
2
6
 
3
7
  * Add `methods_to_retry` option #33 [edudepetris]
data/README.md CHANGED
@@ -38,7 +38,8 @@ 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: [] # List of methods that will trigger a retry (when empty, all methods will).
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
43
  )
43
44
  ```
44
45
 
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Retry
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
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: [])
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: [])
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
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,21 @@ module Minitest
56
60
  @retry_callback
57
61
  end
58
62
 
59
- def failure_to_retry?(failures = [], klass_method_name)
63
+ def failure_to_retry?(failures = [], klass_method_name, klass)
60
64
  return false if failures.empty?
61
65
 
62
66
  if methods_to_retry.any?
63
67
  return methods_to_retry.include?(klass_method_name)
64
68
  end
65
69
 
66
- return true if Minitest::Retry.exceptions_to_retry.empty?
67
- errors = failures.map(&:error).map(&:class)
68
- (errors & Minitest::Retry.exceptions_to_retry).any?
70
+ if exceptions_to_retry.any?
71
+ errors = failures.map(&:error).map(&:class)
72
+ return (errors & exceptions_to_retry).any?
73
+ end
74
+
75
+ return true if classes_to_retry.empty?
76
+ ancestors = klass.ancestors.map(&:to_s)
77
+ return classes_to_retry.any? { |class_to_retry| ancestors.include?(class_to_retry) }
69
78
  end
70
79
  end
71
80
 
@@ -74,7 +83,7 @@ module Minitest
74
83
  result = super(klass, method_name)
75
84
 
76
85
  klass_method_name = "#{klass.name}##{method_name}"
77
- return result unless Minitest::Retry.failure_to_retry?(result.failures, klass_method_name)
86
+ return result unless Minitest::Retry.failure_to_retry?(result.failures, klass_method_name, klass)
78
87
  if !result.skipped?
79
88
  Minitest::Retry.failure_callback.call(klass, method_name, result) if Minitest::Retry.failure_callback
80
89
  Minitest::Retry.retry_count.times do |count|
@@ -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,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-retry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Yaginuma
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-17 00:00:00.000000000 Z
11
+ date: 2024-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -59,6 +59,7 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".github/workflows/stale.yml"
62
63
  - ".github/workflows/ubuntu.yml"
63
64
  - ".gitignore"
64
65
  - CHANGELOG.md
@@ -76,6 +77,7 @@ licenses:
76
77
  - MIT
77
78
  metadata:
78
79
  allowed_push_host: https://rubygems.org
80
+ rubygems_mfa_required: 'true'
79
81
  post_install_message:
80
82
  rdoc_options: []
81
83
  require_paths:
@@ -91,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
93
  - !ruby/object:Gem::Version
92
94
  version: '0'
93
95
  requirements: []
94
- rubygems_version: 3.0.3
96
+ rubygems_version: 3.5.11
95
97
  signing_key:
96
98
  specification_version: 4
97
99
  summary: re-run the test when the test fails