minitest-retry 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +5 -0
- data/Gemfile +5 -0
- data/README.md +73 -0
- data/Rakefile +11 -0
- data/bin/console +11 -0
- data/bin/setup +7 -0
- data/lib/minitest/retry.rb +48 -0
- data/lib/minitest/retry/version.rb +5 -0
- data/minitest-retry.gemspec +28 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 34effe9f4847a7d1705f3121a91dee8da757eb81
|
4
|
+
data.tar.gz: 1c976adffdacb719d1e9f917234d47efc5ad51c9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 097f13c03079b3acca8a89de61319e4d439fe2148b345ad8b76f68103056542d078b6203fa3b2c23c82ce673c5f241ee53e4701aec755ff0cdcb87ef3ac8a37c
|
7
|
+
data.tar.gz: f65e4a96420b41a185345f06e5a50ca576f5b7df45f88bfff27d48066cb69303b3303aa60c98683fd26a7f35679ed8335fe369ab0a08842cb14aa93d9fdb799c
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Minitest::Retry
|
2
|
+
|
3
|
+
Re-run the test when the test fails.
|
4
|
+
|
5
|
+
[![Build Status](https://travis-ci.org/y-yagi/minitest-retry.svg?branch=master)](https://travis-ci.org/y-yagi/minitest-retry)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'minitest-retry'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install minitest-retry
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
In your `test_helper.rb` file, add the following lines:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'minitest/retry'
|
29
|
+
Minitest::Retry.use!
|
30
|
+
```
|
31
|
+
|
32
|
+
Options can be specified to `use!` method. Can specify options are as follows:
|
33
|
+
|
34
|
+
```
|
35
|
+
Minitest::Retry.use!(
|
36
|
+
retry_count: 3 # The number of times to retry. The default is 3.
|
37
|
+
verbose: true # Whether or not to display the message at the time of retry. The default is true.
|
38
|
+
io: $stdout # Display destination of retry when the message. The default is stdout.
|
39
|
+
)
|
40
|
+
```
|
41
|
+
|
42
|
+
## Example
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
|
46
|
+
Minitest::Retry.use!
|
47
|
+
|
48
|
+
class Minitest::RetryTest < Minitest::Test
|
49
|
+
def test_fail
|
50
|
+
assert false, 'test fail'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
```console
|
56
|
+
# Running:
|
57
|
+
|
58
|
+
[MiniestRetry] retry 'test_fail' count: 1, msg: test fail
|
59
|
+
[MiniestRetry] retry 'test_fail' count: 2, msg: test fail
|
60
|
+
[MiniestRetry] retry 'test_fail' count: 3, msg: test fail
|
61
|
+
F
|
62
|
+
|
63
|
+
Finished in 0.002479s, 403.4698 runs/s, 403.4698 assertions/s.
|
64
|
+
|
65
|
+
1) Failure:
|
66
|
+
Minitest::RetryTest#test_fail [test/minitest/sample_test.rb:6]:
|
67
|
+
test fail
|
68
|
+
```
|
69
|
+
|
70
|
+
## Contributing
|
71
|
+
|
72
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/y-yagi/minitest-retry.
|
73
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "minitest/retry"
|
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
|
data/bin/setup
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require "minitest/retry/version"
|
2
|
+
|
3
|
+
module Minitest
|
4
|
+
module Retry
|
5
|
+
def self.use!(retry_count: 3, io: $stdout, verbose: true)
|
6
|
+
@retry_count, @io, @verbose = retry_count, io, verbose
|
7
|
+
Minitest.prepend(self)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.retry_count
|
11
|
+
@retry_count
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.io
|
15
|
+
@io
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.verbose
|
19
|
+
@verbose
|
20
|
+
end
|
21
|
+
|
22
|
+
module ClassMethods
|
23
|
+
def run_one_method(klass, method_name)
|
24
|
+
retry_count = Minitest::Retry.retry_count
|
25
|
+
result = super(klass, method_name)
|
26
|
+
unless result.failures.empty?
|
27
|
+
retry_count.times do |count|
|
28
|
+
if Minitest::Retry.verbose && Minitest::Retry.io
|
29
|
+
msg = "[MiniestRetry] retry '%s' count: %s, msg: %s\n" %
|
30
|
+
[method_name, count + 1, result.failures.join(",")]
|
31
|
+
Minitest::Retry.io.puts(msg)
|
32
|
+
end
|
33
|
+
|
34
|
+
result = super(klass, method_name)
|
35
|
+
break if result.failures.empty?
|
36
|
+
end
|
37
|
+
end
|
38
|
+
result
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.prepended(base)
|
43
|
+
class << base
|
44
|
+
prepend ClassMethods
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'minitest/retry/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "minitest-retry"
|
7
|
+
spec.version = Minitest::Retry::VERSION
|
8
|
+
spec.authors = ["Yuji Yaginuma"]
|
9
|
+
spec.email = ["yuuji.yaginuma@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{re-run the test when the test fails}
|
12
|
+
spec.description = %q{re-run the test when the test fails}
|
13
|
+
spec.homepage = "https://github.com/y-yagi/minitest-retry"
|
14
|
+
|
15
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
16
|
+
# delete this section to allow pushing this gem to any host.
|
17
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency 'minitest', '>= 5.0'
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: minitest-retry
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yuji Yaginuma
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: minitest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: re-run the test when the test fails
|
56
|
+
email:
|
57
|
+
- yuuji.yaginuma@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
64
|
+
- Gemfile
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- bin/console
|
68
|
+
- bin/setup
|
69
|
+
- lib/minitest/retry.rb
|
70
|
+
- lib/minitest/retry/version.rb
|
71
|
+
- minitest-retry.gemspec
|
72
|
+
homepage: https://github.com/y-yagi/minitest-retry
|
73
|
+
licenses: []
|
74
|
+
metadata:
|
75
|
+
allowed_push_host: https://rubygems.org
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.4.5
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: re-run the test when the test fails
|
96
|
+
test_files: []
|