maxitest 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +1 -0
- data/lib/maxitest/timeout.rb +37 -0
- data/lib/maxitest/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23ffc55ac5838f7616fbd1f3730ca2b437451ee1
|
4
|
+
data.tar.gz: 8bb2adea9ffb877e7c88fe98f4e64473e88e6fb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb18db7c7db8056bc9bbfe895455a8ddefd7e76e8449bc3f4b258e9944715d4457d2e6d8cf831922ca715d5062c3055465642be42b2761973ea39f7166187f86
|
7
|
+
data.tar.gz: 1e37bb695a936a4b0370a8d50bce889a20d568784fa69a7d33ceb445b3d86f44f2524d6ac01ebe70a650fe38ea5a4261630d58524630a23ef35c4733921dc226
|
data/Readme.md
CHANGED
@@ -19,6 +19,7 @@ Features
|
|
19
19
|
- `pending { assert false }` is skip when it fails, but fails when it passes
|
20
20
|
- implicit subject via `require 'maxitest/implicit_subject'`
|
21
21
|
- `xit` to skip test (also does not call setup or teardown)
|
22
|
+
- `require 'maxitest/timeout'` to make hanging tests fail after `Maxitest.timeout` seconds
|
22
23
|
|
23
24
|
Install
|
24
25
|
=======
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# tests sometimes hang locally or on ci and with this we can actually debug the cause instead of just hanging forever
|
2
|
+
require 'timeout'
|
3
|
+
|
4
|
+
module Maxitest
|
5
|
+
class << self
|
6
|
+
attr_accessor :timeout
|
7
|
+
end
|
8
|
+
|
9
|
+
module Timeout
|
10
|
+
class TestCaseTimeout < StandardError
|
11
|
+
def message
|
12
|
+
"Test took too long to finish, aborting. To use a debugger, set Maxitest.timeout = false at the top of the test file."
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def capture_exceptions(*, &block)
|
17
|
+
if Maxitest.timeout == false
|
18
|
+
super
|
19
|
+
else
|
20
|
+
super do
|
21
|
+
rescued = false
|
22
|
+
begin
|
23
|
+
::Timeout.timeout(Maxitest.timeout || 5, TestCaseTimeout, &block)
|
24
|
+
rescue TestCaseTimeout => e
|
25
|
+
raise e if rescued
|
26
|
+
rescued = true
|
27
|
+
retry
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
Minitest::Test.send :prepend, Maxitest::Timeout
|
36
|
+
|
37
|
+
|
data/lib/maxitest/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maxitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/maxitest/let_bang.rb
|
104
104
|
- lib/maxitest/pending.rb
|
105
105
|
- lib/maxitest/static_class_order.rb
|
106
|
+
- lib/maxitest/timeout.rb
|
106
107
|
- lib/maxitest/trap.rb
|
107
108
|
- lib/maxitest/vendor/around.rb
|
108
109
|
- lib/maxitest/vendor/line.rb
|
@@ -131,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
132
|
version: '0'
|
132
133
|
requirements: []
|
133
134
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.
|
135
|
+
rubygems_version: 2.5.1
|
135
136
|
signing_key:
|
136
137
|
specification_version: 4
|
137
138
|
summary: Minitest + all the features you always wanted
|