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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f7a959bce33bc6372c4684a4dc1a828595e2945
4
- data.tar.gz: e182004194ac36e9eacd0cfaacea0b06efc386ef
3
+ metadata.gz: 23ffc55ac5838f7616fbd1f3730ca2b437451ee1
4
+ data.tar.gz: 8bb2adea9ffb877e7c88fe98f4e64473e88e6fb7
5
5
  SHA512:
6
- metadata.gz: 327ebb50e41dd48c94c6722f6c8daf4bfc294978b6b5bb39c2586c272c1ed7be6b72f33fbde70b33f553cd996bc3c4870205e48ead93484043abcd84a29d0c73
7
- data.tar.gz: 444d68862f2a1c0cd089994d480a943b2dedb32f3de81a40d9ec96bb821cff1c33cccf4a0ff40138f7c8221ccb86d789e6a842a06168c30f4cf018ef04f3d136
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
+
@@ -1,3 +1,3 @@
1
1
  module Maxitest
2
- VERSION = "2.0.2"
2
+ VERSION = "2.1.0"
3
3
  end
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.2
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-06-30 00:00:00.000000000 Z
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.4.5.1
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