minitest-speed 1.0.0
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 +7 -0
- checksums.yaml.gz.sig +3 -0
- data.tar.gz.sig +0 -0
- data/.autotest +26 -0
- data/History.rdoc +6 -0
- data/Manifest.txt +7 -0
- data/README.rdoc +63 -0
- data/Rakefile +30 -0
- data/lib/minitest/speed.rb +58 -0
- data/test/test_minitest_speed.rb +54 -0
- metadata +110 -0
- metadata.gz.sig +1 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2eec3a82a928a83e3f6b6a876d0271d1b6ab8c74
|
4
|
+
data.tar.gz: 3cdd11b5845af70c73cb3690dc103bc635e90527
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7f13124880d1d34161720ffee5d5dad972da747acc8c84ce6747515221ba255ad90a21e2ed604cc846051551436f8a36abb5c7a0229768f2b9f04bc4dde7b16e
|
7
|
+
data.tar.gz: cf0d6fedf3e8d1b32fa7b62510af324b61a1b5eb59fce0ee6ae461f9d7ca2fcceef54d5cc1783c58eb40b77cb76d87d364311db7e978c7656e392b883cf1463c
|
checksums.yaml.gz.sig
ADDED
data.tar.gz.sig
ADDED
Binary file
|
data/.autotest
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require "autotest/restart"
|
4
|
+
|
5
|
+
Autotest.add_hook :initialize do |at|
|
6
|
+
at.testlib = "minitest/autorun"
|
7
|
+
at.add_exception "tmp"
|
8
|
+
|
9
|
+
# at.extra_files << "../some/external/dependency.rb"
|
10
|
+
#
|
11
|
+
# at.libs << ":../some/external"
|
12
|
+
#
|
13
|
+
# at.add_exception "vendor"
|
14
|
+
#
|
15
|
+
# at.add_mapping(/dependency.rb/) do |f, _|
|
16
|
+
# at.files_matching(/test_.*rb$/)
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# %w(TestA TestB).each do |klass|
|
20
|
+
# at.extra_class_map[klass] = "test/test_misc.rb"
|
21
|
+
# end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Autotest.add_hook :run_command do |at|
|
25
|
+
# system "rake build"
|
26
|
+
# end
|
data/History.rdoc
ADDED
data/Manifest.txt
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
= minitest-speed
|
2
|
+
|
3
|
+
home :: https://github.com/seattlerb/minitest-speed
|
4
|
+
rdoc :: http://docs.seattlerb.org/minitest-speed
|
5
|
+
|
6
|
+
== DESCRIPTION:
|
7
|
+
|
8
|
+
minitest-speed adds test hooks to verify the time it takes to run the
|
9
|
+
setup, body, and teardown phases of each test. If the time of any
|
10
|
+
phase goes over the maximum time, it fails the test. Use class
|
11
|
+
variables to set the maximum thresholds and crank it down over time.
|
12
|
+
|
13
|
+
== FEATURES/PROBLEMS:
|
14
|
+
|
15
|
+
* Simple module inclusion to activate
|
16
|
+
* Tweakable thresholds for each phase.
|
17
|
+
|
18
|
+
== SYNOPSIS:
|
19
|
+
|
20
|
+
class SpeedTest < Minitest::Test
|
21
|
+
include Minitest::Speed
|
22
|
+
|
23
|
+
@@max_setup_time = 0.01
|
24
|
+
@@max_test_time = 0.01
|
25
|
+
@@max_teardown_time = 0.01
|
26
|
+
end
|
27
|
+
|
28
|
+
class MyTest << SpeedTest
|
29
|
+
# ...
|
30
|
+
end
|
31
|
+
|
32
|
+
== REQUIREMENTS:
|
33
|
+
|
34
|
+
* minitest 5+
|
35
|
+
|
36
|
+
== INSTALL:
|
37
|
+
|
38
|
+
* sudo gem install minitest-speed
|
39
|
+
|
40
|
+
== LICENSE:
|
41
|
+
|
42
|
+
(The MIT License)
|
43
|
+
|
44
|
+
Copyright (c) Ryan Davis, seattle.rb
|
45
|
+
|
46
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
47
|
+
a copy of this software and associated documentation files (the
|
48
|
+
'Software'), to deal in the Software without restriction, including
|
49
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
50
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
51
|
+
permit persons to whom the Software is furnished to do so, subject to
|
52
|
+
the following conditions:
|
53
|
+
|
54
|
+
The above copyright notice and this permission notice shall be
|
55
|
+
included in all copies or substantial portions of the Software.
|
56
|
+
|
57
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
58
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
59
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
60
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
61
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
62
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
63
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
require "hoe"
|
5
|
+
|
6
|
+
Hoe.plugin :isolate
|
7
|
+
Hoe.plugin :seattlerb
|
8
|
+
Hoe.plugin :rdoc
|
9
|
+
|
10
|
+
# Hoe.plugin :compiler
|
11
|
+
# Hoe.plugin :doofus
|
12
|
+
# Hoe.plugin :email
|
13
|
+
# Hoe.plugin :gem_prelude_sucks
|
14
|
+
# Hoe.plugin :history
|
15
|
+
# Hoe.plugin :inline
|
16
|
+
# Hoe.plugin :isolate
|
17
|
+
# Hoe.plugin :minitest
|
18
|
+
# Hoe.plugin :perforce
|
19
|
+
# Hoe.plugin :racc
|
20
|
+
# Hoe.plugin :rcov
|
21
|
+
# Hoe.plugin :rdoc
|
22
|
+
# Hoe.plugin :seattlerb
|
23
|
+
|
24
|
+
Hoe.spec "minitest-speed" do
|
25
|
+
developer "Ryan Davis", "ryand-ruby@zenspider.com"
|
26
|
+
|
27
|
+
license "MIT"
|
28
|
+
end
|
29
|
+
|
30
|
+
# vim: syntax=ruby
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Minitest; end # :nodoc:
|
2
|
+
|
3
|
+
##
|
4
|
+
# Adds test hooks to verify the time it takes to run the setup, body,
|
5
|
+
# and teardown phases of each test. If the time of any phase goes over
|
6
|
+
# the maximum time, it fails the test. Use class variables to set the
|
7
|
+
# maximum thresholds and crank it down over time.
|
8
|
+
|
9
|
+
module Minitest::Speed
|
10
|
+
VERSION = "1.0.0" # :nodoc:
|
11
|
+
|
12
|
+
##
|
13
|
+
# Maximum setup time to pass a speed test. Default to 1.0 second.
|
14
|
+
|
15
|
+
@@max_setup_time = 1.0
|
16
|
+
|
17
|
+
##
|
18
|
+
# Maximum test time to pass a speed test. Default to 1.0 second.
|
19
|
+
|
20
|
+
@@max_test_time = 1.0
|
21
|
+
|
22
|
+
##
|
23
|
+
# Maximum teardown time to pass a speed test. Default to 1.0 second.
|
24
|
+
|
25
|
+
@@max_teardown_time = 1.0
|
26
|
+
|
27
|
+
def before_setup # :nodoc:
|
28
|
+
super
|
29
|
+
|
30
|
+
@setup_t0 = Time.now
|
31
|
+
end
|
32
|
+
|
33
|
+
def after_setup # :nodoc:
|
34
|
+
delta = Time.now - @setup_t0
|
35
|
+
|
36
|
+
@test_t0 = Time.now
|
37
|
+
|
38
|
+
assert_operator delta, :<=, @@max_setup_time
|
39
|
+
|
40
|
+
super
|
41
|
+
end
|
42
|
+
|
43
|
+
def before_teardown # :nodoc:
|
44
|
+
super
|
45
|
+
|
46
|
+
@teardown_t0 = Time.now
|
47
|
+
|
48
|
+
delta = Time.now - @test_t0
|
49
|
+
assert_operator delta, :<=, @@max_teardown_time
|
50
|
+
end
|
51
|
+
|
52
|
+
def after_teardown # :nodoc:
|
53
|
+
delta = Time.now - @teardown_t0
|
54
|
+
|
55
|
+
assert_operator delta, :<=, @@max_teardown_time
|
56
|
+
super
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "minitest/speed"
|
3
|
+
|
4
|
+
module TestMinitest; end
|
5
|
+
|
6
|
+
class SpeedTest < Minitest::Test
|
7
|
+
include Minitest::Speed
|
8
|
+
|
9
|
+
@@max_setup_time = 0.01
|
10
|
+
@@max_test_time = 0.01
|
11
|
+
@@max_teardown_time = 0.01
|
12
|
+
|
13
|
+
def self.go(&b)
|
14
|
+
Class.new(SpeedTest, &b).new(:test_something).run
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class TestMinitest::TestSpeed < Minitest::Test
|
19
|
+
def assert_test_speed(&b)
|
20
|
+
refute_predicate SpeedTest.go(&b), :passed?
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_slow_setup
|
24
|
+
assert_test_speed do
|
25
|
+
def setup
|
26
|
+
sleep 0.1
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_something
|
30
|
+
assert true
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_slow_test
|
36
|
+
assert_test_speed do
|
37
|
+
def test_something
|
38
|
+
sleep 0.1
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_slow_teardown
|
44
|
+
assert_test_speed do
|
45
|
+
def teardown
|
46
|
+
sleep 0.1
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_something
|
50
|
+
assert true
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: minitest-speed
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan Davis
|
8
|
+
autorequire:
|
9
|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SGPFRBTc
|
27
|
+
SilobMRoGs/7B15uGFUEnNrCB/ltMqhwwSx1r++UQPfeySHEV9uqu03E5Vb7J37O
|
28
|
+
2Er6PLXHRiYsIycD1LkMi6YnixdITRHmrqJYE2rsjaIfpIehiusVAPHkNf7qbpHq
|
29
|
+
qx3h45R1CAsObX0SQDIT+rRbQrtKz1GHIZTOFYvEJjUY1XmRTZupD3CJ8Q7sDqSy
|
30
|
+
NLq5jm1fq6Y9Uolu3RJbmycf
|
31
|
+
-----END CERTIFICATE-----
|
32
|
+
date: 2016-04-23 00:00:00.000000000 Z
|
33
|
+
dependencies:
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: rdoc
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4.0'
|
41
|
+
type: :development
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.0'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: hoe
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.15'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.15'
|
62
|
+
description: |-
|
63
|
+
minitest-speed adds test hooks to verify the time it takes to run the
|
64
|
+
setup, body, and teardown phases of each test. If the time of any
|
65
|
+
phase goes over the maximum time, it fails the test. Use class
|
66
|
+
variables to set the maximum thresholds and crank it down over time.
|
67
|
+
email:
|
68
|
+
- ryand-ruby@zenspider.com
|
69
|
+
executables: []
|
70
|
+
extensions: []
|
71
|
+
extra_rdoc_files:
|
72
|
+
- History.rdoc
|
73
|
+
- Manifest.txt
|
74
|
+
- README.rdoc
|
75
|
+
files:
|
76
|
+
- .autotest
|
77
|
+
- History.rdoc
|
78
|
+
- Manifest.txt
|
79
|
+
- README.rdoc
|
80
|
+
- Rakefile
|
81
|
+
- lib/minitest/speed.rb
|
82
|
+
- test/test_minitest_speed.rb
|
83
|
+
homepage: https://github.com/seattlerb/minitest-speed
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options:
|
89
|
+
- --main
|
90
|
+
- README.rdoc
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.4.5
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: minitest-speed adds test hooks to verify the time it takes to run the setup,
|
109
|
+
body, and teardown phases of each test
|
110
|
+
test_files: []
|
metadata.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
F0�d��C�3���4v�����Z�ҏ��Z�<Q���D���0�)�K!t�uS;G��;)B_�OVh�z��߇<�U�j5�Tk��U��������f�76yi���A|i D\dm��I�Im�i��t��@�Q��C�0�����'��|���x�)�'�@݉�f�i��⻜n����"�)�Ѫh�Fli��d�%���c���?p)��{H�V�7��Hs�V���/�w��9d���9áiE)��`/�i+��@K
|