minitest-perf 0.0.3 → 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/.travis.yml +8 -0
- data/Gemfile +3 -0
- data/README.md +8 -3
- data/lib/minitest/perf.rb +4 -4
- data/lib/minitest/perf/cli.rb +1 -1
- data/lib/minitest/perf/persistence.rb +1 -1
- data/lib/minitest/perf/plugin.rb +4 -4
- data/lib/minitest/perf/run.rb +1 -1
- data/lib/minitest/perf/statistics.rb +3 -3
- data/lib/minitest/perf/test.rb +1 -1
- data/lib/minitest/perf/version.rb +2 -2
- data/minitest-perf.gemspec +3 -4
- data/test/perf/persistence_test.rb +2 -2
- data/test/perf/plugin_test.rb +2 -2
- data/test/perf/run_test.rb +2 -2
- data/test/perf/test_test.rb +3 -3
- data/test/perf_test.rb +8 -8
- data/test/test_helper.rb +7 -4
- metadata +27 -54
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7f12a2b83a233ba3f93ed3eac0699d9bf4fa66fb
|
4
|
+
data.tar.gz: b8e157fc2d413f4740789233bfab1896603d5b2a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dedc1ed29bf47ab48aa3463df2c98684576dfa6865e578bb26dafc2ed930293c7ce4a5f18b7bda5508d56e95a1ae9f880e54cbebf15ffe7ff780d5e9a41709e0
|
7
|
+
data.tar.gz: 8e26a15093a43c8f638009c72fa5e373f69e911f2ba0cbe1bb62bf995fd94992c12d134b51548512ad7e601f482f5dad18b1cca42471f304ceacbb93a8a23a43
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
# MiniTest::Perf
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/rom-rb/rom.png?branch=master)][travis]
|
4
|
+
[![Code Climate](https://codeclimate.com/github/mrsimo/minitest-perf.png)][codeclimate]
|
5
|
+
|
6
|
+
[travis]: https://travis-ci.org/mrsimo/minitest-perf
|
7
|
+
[codeclimate]: https://codeclimate.com/github/mrsimo/minitest-perf
|
8
|
+
|
3
9
|
`minitest-perf` stores information about your minitest runs so that you can later analyze and see where
|
4
10
|
the pain points are. It's in pretty early beta status, so I'm more than glad to receive bug reports and
|
5
11
|
feature suggestions.
|
6
12
|
|
7
|
-
|
8
|
-
is with this version. MiniTest 5 probably doesn't work yet.
|
13
|
+
The current version works with Minitest 5 thanks to @nateberkopec, for Minitest 4 use version 0.0.3.
|
9
14
|
|
10
15
|
## How it works
|
11
16
|
|
@@ -19,7 +24,7 @@ environment variable `MINITEST_PERF_DATABASE_URL`, or the `DATABASE_URL`.
|
|
19
24
|
Or setting it directly via ruby with:
|
20
25
|
|
21
26
|
```ruby
|
22
|
-
|
27
|
+
Minitest::Perf.database_url = 'sqlite3://localhost/some_other_file.db'
|
23
28
|
```
|
24
29
|
|
25
30
|
So far only local `sqlite3` databases allowed, but I'm using the database url strategy to allow for
|
data/lib/minitest/perf.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'minitest/perf/version'
|
2
|
-
require 'minitest
|
2
|
+
require 'minitest'
|
3
3
|
|
4
|
-
module
|
4
|
+
module Minitest::Perf
|
5
5
|
autoload :Run, 'minitest/perf/run'
|
6
6
|
autoload :Test, 'minitest/perf/test'
|
7
7
|
autoload :Suite, 'minitest/perf/suite'
|
@@ -26,6 +26,6 @@ module MiniTest::Perf
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
class
|
30
|
-
include
|
29
|
+
class Minitest::Test
|
30
|
+
include Minitest::Perf::Plugin
|
31
31
|
end
|
data/lib/minitest/perf/cli.rb
CHANGED
data/lib/minitest/perf/plugin.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
module
|
1
|
+
module Minitest
|
2
2
|
module Perf
|
3
3
|
module Plugin
|
4
4
|
def before_setup
|
5
|
-
current_perf_run.start(self.class.name,
|
5
|
+
current_perf_run.start(self.class.name, name)
|
6
6
|
super
|
7
7
|
end
|
8
8
|
|
9
9
|
def after_teardown
|
10
10
|
super
|
11
|
-
current_perf_run.finish(self.class.name,
|
11
|
+
current_perf_run.finish(self.class.name, name)
|
12
12
|
end
|
13
13
|
|
14
14
|
def current_perf_run
|
15
|
-
@@current_perf_run ||=
|
15
|
+
@@current_perf_run ||= Minitest::Perf::Run.new
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/minitest/perf/run.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
module
|
1
|
+
module Minitest
|
2
2
|
module Perf
|
3
3
|
module Statistics
|
4
4
|
class << self
|
5
5
|
def slowest_tests
|
6
|
-
|
6
|
+
Minitest::Perf.persistence.sql(<<-SQL)
|
7
7
|
SELECT suite, name, avg(total) as avg_total
|
8
8
|
FROM tests
|
9
9
|
GROUP BY suite, name
|
@@ -13,7 +13,7 @@ module MiniTest
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def slowest_suites
|
16
|
-
|
16
|
+
Minitest::Perf.persistence.sql(<<-SQL)
|
17
17
|
SELECT suite, AVG(test_count), AVG(avg_total_per_test_run) as avg_total
|
18
18
|
FROM (
|
19
19
|
SELECT run, suite, COUNT(name) AS test_count, AVG(total) as avg_total_per_test_run
|
data/lib/minitest/perf/test.rb
CHANGED
data/minitest-perf.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'minitest/perf/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "minitest-perf"
|
8
|
-
spec.version =
|
8
|
+
spec.version = Minitest::Perf::VERSION
|
9
9
|
spec.authors = ["Albert Llop"]
|
10
10
|
spec.email = ["mrsimo@gmail.com"]
|
11
11
|
spec.description = %q{Save test run data to find slow tests and other interesting information}
|
@@ -24,8 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
26
26
|
spec.add_development_dependency "rake"
|
27
|
-
spec.add_development_dependency "mocha"
|
28
|
-
spec.
|
29
|
-
spec.add_dependency "minitest", "~> 4.0"
|
27
|
+
spec.add_development_dependency "mocha", "~> 1.1"
|
28
|
+
spec.add_dependency "minitest", "~> 5.0"
|
30
29
|
spec.add_dependency "sqlite3"
|
31
30
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'sqlite3'
|
3
3
|
|
4
|
-
module
|
5
|
-
class PersistenceTest <
|
4
|
+
module Minitest::Perf
|
5
|
+
class PersistenceTest < Minitest::Test
|
6
6
|
TEST_DB_FILE = '.minitest-perf-tests.db'
|
7
7
|
def setup
|
8
8
|
File.delete(TEST_DB_FILE) rescue Errno::ENOENT # First time won't be here
|
data/test/perf/plugin_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class PluginTest <
|
3
|
+
class PluginTest < Minitest::Test
|
4
4
|
def test_minitest_has_the_plugin_included
|
5
|
-
assert_includes
|
5
|
+
assert_includes Minitest::Test.included_modules, Minitest::Perf::Plugin
|
6
6
|
end
|
7
7
|
end
|
data/test/perf/run_test.rb
CHANGED
data/test/perf/test_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
module
|
4
|
-
class TestTest <
|
3
|
+
module Minitest::Perf
|
4
|
+
class TestTest < Minitest::Test
|
5
5
|
def test_creation
|
6
6
|
test = Test.new('run', 'suite', 'name', 10)
|
7
7
|
|
@@ -14,7 +14,7 @@ module MiniTest::Perf
|
|
14
14
|
def test_persists_calls_persistence
|
15
15
|
test = Test.new('run', 'suite', 'name', 10)
|
16
16
|
|
17
|
-
|
17
|
+
Minitest::Perf.persistence.expects(:write).with(test)
|
18
18
|
|
19
19
|
test.persist
|
20
20
|
end
|
data/test/perf_test.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
module
|
4
|
-
class PerfTest <
|
3
|
+
module Minitest
|
4
|
+
class PerfTest < Minitest::Test
|
5
5
|
def test_default_database
|
6
|
-
|
6
|
+
Minitest::Perf.database_url = nil
|
7
7
|
|
8
|
-
assert_equal 'sqlite3://localhost/.minitest-perf.db',
|
8
|
+
assert_equal 'sqlite3://localhost/.minitest-perf.db', Minitest::Perf.database_url
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_customizable_database
|
12
|
-
|
13
|
-
|
12
|
+
Minitest::Perf.persistence = nil
|
13
|
+
Minitest::Perf.database_url = 'sqlite3://localhost/some_other_file.db'
|
14
14
|
|
15
|
-
assert_equal 'sqlite3://localhost/some_other_file.db',
|
16
|
-
assert_equal 'sqlite3://localhost/some_other_file.db',
|
15
|
+
assert_equal 'sqlite3://localhost/some_other_file.db', Minitest::Perf.database_url
|
16
|
+
assert_equal 'sqlite3://localhost/some_other_file.db', Minitest::Perf.persistence.database_url
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/test/test_helper.rb
CHANGED
@@ -2,10 +2,13 @@ require 'rubygems'
|
|
2
2
|
require 'bundler/setup'
|
3
3
|
require 'minitest/autorun'
|
4
4
|
require 'minitest/pride'
|
5
|
-
require 'mocha/setup'
|
6
|
-
require 'debugger'
|
7
|
-
|
8
5
|
require 'minitest/perf'
|
6
|
+
require 'mocha/mini_test'
|
7
|
+
require 'simplecov'
|
8
|
+
|
9
|
+
SimpleCov.start do
|
10
|
+
add_filter "/test/"
|
11
|
+
end
|
9
12
|
|
10
13
|
##
|
11
14
|
# We disable the real plugin or stuff gets all confusing
|
@@ -15,7 +18,7 @@ class FakeRun
|
|
15
18
|
def finish(*pars); end
|
16
19
|
end
|
17
20
|
|
18
|
-
|
21
|
+
Minitest::Perf::Plugin.class_eval do
|
19
22
|
def current_perf_run
|
20
23
|
@current_perf_run ||= FakeRun.new
|
21
24
|
end
|
metadata
CHANGED
@@ -1,110 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-perf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.0.3
|
4
|
+
version: 0.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Albert Llop
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
|
-
type: :development
|
17
15
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
16
|
requirements:
|
20
|
-
- - ~>
|
17
|
+
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: '1.3'
|
20
|
+
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.3'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
|
-
type: :development
|
33
29
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
30
|
requirements:
|
36
|
-
- -
|
31
|
+
- - ">="
|
37
32
|
- !ruby/object:Gem::Version
|
38
33
|
version: '0'
|
34
|
+
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: mocha
|
48
|
-
type: :development
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
44
|
requirements:
|
52
|
-
- -
|
45
|
+
- - "~>"
|
53
46
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: debugger
|
47
|
+
version: '1.1'
|
64
48
|
type: :development
|
65
|
-
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
|
-
requirements:
|
68
|
-
- - ! '>='
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '0'
|
71
49
|
prerelease: false
|
72
50
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
51
|
requirements:
|
75
|
-
- -
|
52
|
+
- - "~>"
|
76
53
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
54
|
+
version: '1.1'
|
78
55
|
- !ruby/object:Gem::Dependency
|
79
56
|
name: minitest
|
80
|
-
type: :runtime
|
81
57
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
58
|
requirements:
|
84
|
-
- - ~>
|
59
|
+
- - "~>"
|
85
60
|
- !ruby/object:Gem::Version
|
86
|
-
version: '
|
61
|
+
version: '5.0'
|
62
|
+
type: :runtime
|
87
63
|
prerelease: false
|
88
64
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
65
|
requirements:
|
91
|
-
- - ~>
|
66
|
+
- - "~>"
|
92
67
|
- !ruby/object:Gem::Version
|
93
|
-
version: '
|
68
|
+
version: '5.0'
|
94
69
|
- !ruby/object:Gem::Dependency
|
95
70
|
name: sqlite3
|
96
|
-
type: :runtime
|
97
71
|
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
72
|
requirements:
|
100
|
-
- -
|
73
|
+
- - ">="
|
101
74
|
- !ruby/object:Gem::Version
|
102
75
|
version: '0'
|
76
|
+
type: :runtime
|
103
77
|
prerelease: false
|
104
78
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
79
|
requirements:
|
107
|
-
- -
|
80
|
+
- - ">="
|
108
81
|
- !ruby/object:Gem::Version
|
109
82
|
version: '0'
|
110
83
|
description: Save test run data to find slow tests and other interesting information
|
@@ -115,7 +88,8 @@ executables:
|
|
115
88
|
extensions: []
|
116
89
|
extra_rdoc_files: []
|
117
90
|
files:
|
118
|
-
- .gitignore
|
91
|
+
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
119
93
|
- Gemfile
|
120
94
|
- LICENSE.txt
|
121
95
|
- README.md
|
@@ -140,27 +114,26 @@ files:
|
|
140
114
|
homepage: https://github.com/mrsimo/minitest-perf
|
141
115
|
licenses:
|
142
116
|
- MIT
|
117
|
+
metadata: {}
|
143
118
|
post_install_message:
|
144
119
|
rdoc_options: []
|
145
120
|
require_paths:
|
146
121
|
- lib
|
147
122
|
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
-
none: false
|
149
123
|
requirements:
|
150
|
-
- -
|
124
|
+
- - ">="
|
151
125
|
- !ruby/object:Gem::Version
|
152
126
|
version: '0'
|
153
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
-
none: false
|
155
128
|
requirements:
|
156
|
-
- -
|
129
|
+
- - ">="
|
157
130
|
- !ruby/object:Gem::Version
|
158
131
|
version: '0'
|
159
132
|
requirements: []
|
160
133
|
rubyforge_project:
|
161
|
-
rubygems_version:
|
134
|
+
rubygems_version: 2.4.1
|
162
135
|
signing_key:
|
163
|
-
specification_version:
|
136
|
+
specification_version: 4
|
164
137
|
summary: Require minitest/perf when running your tests, and a handful of data will
|
165
138
|
be recorded for later query and study. Find particularly slow tests, and understand
|
166
139
|
your tests even more.
|