minitest-excludes 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +3 -0
- data/.autotest +26 -0
- data/.gemtest +0 -0
- data/History.txt +12 -0
- data/Manifest.txt +8 -0
- data/README.txt +64 -0
- data/Rakefile +15 -0
- data/lib/minitest/excludes.rb +75 -0
- data/test/metametameta.rb +43 -0
- data/test/test_minitest_excludes.rb +67 -0
- metadata +145 -0
- metadata.gz.sig +2 -1
data.tar.gz.sig
ADDED
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/.gemtest
ADDED
File without changes
|
data/History.txt
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
=== 1.0.0 / 2011-12-20
|
2
|
+
|
3
|
+
* 1 major enhancement:
|
4
|
+
|
5
|
+
* Split minitest/excludes.rb out to its own gem. (aka Birthday)
|
6
|
+
|
7
|
+
* 3 minor enhancements:
|
8
|
+
|
9
|
+
* Don't keep using the env var, since bad tests may modify ENV w/o restoring it. (headius)
|
10
|
+
* Map X::Y to X/Y.rb for excludes to deal with nested test classes.
|
11
|
+
* Remove method instead of generating a skip to avoid setup/teardown overhead.
|
12
|
+
|
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
= minitest-excludes
|
2
|
+
|
3
|
+
home :: https://github.com/seattlerb/minitest-excludes
|
4
|
+
rdoc :: http://docs.seattlerb.org/minitest-excludes
|
5
|
+
|
6
|
+
== DESCRIPTION:
|
7
|
+
|
8
|
+
minitest/excludes.rb extends MiniTest::Unit::TestCase to provide a
|
9
|
+
clean API for excluding certain tests you don't want to run under
|
10
|
+
certain conditions.
|
11
|
+
|
12
|
+
== FEATURES/PROBLEMS:
|
13
|
+
|
14
|
+
* Simple API to conditionally remove tests you don't want to run.
|
15
|
+
* Uses plain ruby so you can use conditional logic if need be.
|
16
|
+
|
17
|
+
== SYNOPSIS:
|
18
|
+
|
19
|
+
class TestXYZ < MiniTest::Unit::TestCase
|
20
|
+
def test_good
|
21
|
+
test that passes
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_bad
|
25
|
+
test that fails only on jruby
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
For jruby runs, you can add test/excludes/TestXYZ.rb with:
|
30
|
+
|
31
|
+
exclude :test_bad, "Uses ObjectSpace" if jruby?
|
32
|
+
|
33
|
+
== REQUIREMENTS:
|
34
|
+
|
35
|
+
* minitest
|
36
|
+
|
37
|
+
== INSTALL:
|
38
|
+
|
39
|
+
* sudo gem install minitest-excludes
|
40
|
+
|
41
|
+
== LICENSE:
|
42
|
+
|
43
|
+
(The MIT License)
|
44
|
+
|
45
|
+
Copyright (c) Ryan Davis, seattle.rb
|
46
|
+
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
48
|
+
a copy of this software and associated documentation files (the
|
49
|
+
'Software'), to deal in the Software without restriction, including
|
50
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
51
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
52
|
+
permit persons to whom the Software is furnished to do so, subject to
|
53
|
+
the following conditions:
|
54
|
+
|
55
|
+
The above copyright notice and this permission notice shall be
|
56
|
+
included in all copies or substantial portions of the Software.
|
57
|
+
|
58
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
59
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
60
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
61
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
62
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
63
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
64
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
require "hoe"
|
5
|
+
|
6
|
+
Hoe.plugin :isolate
|
7
|
+
Hoe.plugin :seattlerb
|
8
|
+
|
9
|
+
Hoe.spec "minitest-excludes" do
|
10
|
+
developer "Ryan Davis", "ryand-ruby@zenspider.com"
|
11
|
+
|
12
|
+
dependency "minitest", "~> 2.10"
|
13
|
+
end
|
14
|
+
|
15
|
+
# vim: syntax=ruby
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'minitest/unit'
|
2
|
+
|
3
|
+
module MiniTest::Unit::Excludes # :nodoc:
|
4
|
+
VERSION = '1.0.0' # :nodoc:
|
5
|
+
end
|
6
|
+
|
7
|
+
##
|
8
|
+
# minitest/excludes.rb extends MiniTest::Unit::TestCase to provide a
|
9
|
+
# clean API for excluding certain tests you don't want to run under
|
10
|
+
# certain conditions.
|
11
|
+
#
|
12
|
+
# For example, in test/test_xyz.rb you have:
|
13
|
+
#
|
14
|
+
# class TestXYZ < MiniTest::Unit::TestCase
|
15
|
+
# def test_good
|
16
|
+
# # test that passes
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# def test_bad
|
20
|
+
# # test that fails only on jruby
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# For jruby runs, you can add test/excludes/TestXYZ.rb with:
|
25
|
+
#
|
26
|
+
# exclude :test_bad, "Uses ObjectSpace" if jruby?
|
27
|
+
#
|
28
|
+
# The file is instance_eval'd on TestXYZ so you can call the exclude
|
29
|
+
# class method directly. Since it is ruby you can provide any sort
|
30
|
+
# of conditions you want to figure out if your tests should be
|
31
|
+
# excluded.
|
32
|
+
#
|
33
|
+
# TestCase.exclude removes test methods entirely so they don't run
|
34
|
+
# setup/teardown at all.
|
35
|
+
#
|
36
|
+
# If you want to change where the exclude files are located, you can
|
37
|
+
# set the EXCLUDE_DIR environment variable.
|
38
|
+
|
39
|
+
class MiniTest::Unit::TestCase
|
40
|
+
EXCLUDE_DIR = ENV['EXCLUDE_DIR'] || "test/excludes"
|
41
|
+
|
42
|
+
##
|
43
|
+
# Exclude a test from a testcase. This is intended to be used by
|
44
|
+
# exclusion files.
|
45
|
+
|
46
|
+
def self.exclude name, reason
|
47
|
+
return warn "Method #{self}##{name} is not defined" unless
|
48
|
+
method_defined? name
|
49
|
+
|
50
|
+
remove_method name
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Loads the exclusion file for the class, if any.
|
55
|
+
|
56
|
+
def self.load_excludes
|
57
|
+
@__load_excludes__ ||=
|
58
|
+
begin
|
59
|
+
if name and not name.empty? then
|
60
|
+
file = File.join EXCLUDE_DIR, "#{name.gsub(/::/, '/')}.rb"
|
61
|
+
instance_eval File.read file if File.exist? file
|
62
|
+
end
|
63
|
+
true
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class << self
|
68
|
+
alias :old_test_methods :test_methods # :nodoc:
|
69
|
+
|
70
|
+
def test_methods # :nodoc:
|
71
|
+
load_excludes
|
72
|
+
old_test_methods
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'stringio'
|
3
|
+
require 'minitest/autorun'
|
4
|
+
|
5
|
+
class MetaMetaMetaTestCase < MiniTest::Unit::TestCase
|
6
|
+
def assert_report expected = nil
|
7
|
+
expected ||= <<-EOM.gsub(/^ {6}/, '')
|
8
|
+
Run options: --seed 42
|
9
|
+
|
10
|
+
# Running tests:
|
11
|
+
|
12
|
+
.
|
13
|
+
|
14
|
+
Finished tests in 0.00
|
15
|
+
|
16
|
+
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
|
17
|
+
EOM
|
18
|
+
|
19
|
+
output = @output.string.dup
|
20
|
+
output.sub!(/Finished tests in .*/, "Finished tests in 0.00")
|
21
|
+
output.sub!(/Loaded suite .*/, 'Loaded suite blah')
|
22
|
+
output.gsub!(/[\w\/]+\/test\/[^:]+:\d+/, 'FILE:LINE')
|
23
|
+
output.gsub!(/(?:.\/)?test\/[^:]+:\d+/, 'FILE:LINE')
|
24
|
+
output.gsub!(/\[[^\]]+\]/, '[FILE:LINE]')
|
25
|
+
assert_equal(expected, output)
|
26
|
+
end
|
27
|
+
|
28
|
+
def setup
|
29
|
+
super
|
30
|
+
srand 42
|
31
|
+
MiniTest::Unit::TestCase.reset
|
32
|
+
@tu = MiniTest::Unit.new
|
33
|
+
@output = StringIO.new("")
|
34
|
+
MiniTest::Unit.runner = nil # protect the outer runner from the inner tests
|
35
|
+
MiniTest::Unit.output = @output
|
36
|
+
end
|
37
|
+
|
38
|
+
def teardown
|
39
|
+
super
|
40
|
+
MiniTest::Unit.output = $stdout
|
41
|
+
Object.send :remove_const, :ATestCase if defined? ATestCase
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'test/metametameta'
|
2
|
+
require 'minitest/excludes'
|
3
|
+
|
4
|
+
class TestMiniTestExcludes < MetaMetaMetaTestCase
|
5
|
+
def test_cls_excludes
|
6
|
+
srand 42
|
7
|
+
old_exclude_base = MiniTest::Unit::TestCase::EXCLUDE_DIR
|
8
|
+
|
9
|
+
@assertion_count = 0
|
10
|
+
|
11
|
+
Dir.mktmpdir do |path|
|
12
|
+
MiniTest::Unit::TestCase::EXCLUDE_DIR.replace(path)
|
13
|
+
Dir.mkdir File.join path, "ATestCase"
|
14
|
+
|
15
|
+
s = 'exclude :test_test2, "because it is borked"'
|
16
|
+
|
17
|
+
File.open File.join(path, "ATestCase.rb"), "w" do |f|
|
18
|
+
f.puts s
|
19
|
+
end
|
20
|
+
|
21
|
+
File.open File.join(path, "ATestCase/Nested.rb"), "w" do |f|
|
22
|
+
f.puts s
|
23
|
+
end
|
24
|
+
|
25
|
+
tc1 = tc2 = nil
|
26
|
+
|
27
|
+
tc1 = Class.new(MiniTest::Unit::TestCase) do
|
28
|
+
def test_test1; assert true end
|
29
|
+
def test_test2; assert false end # oh noes!
|
30
|
+
def test_test3; assert true end
|
31
|
+
|
32
|
+
tc2 = Class.new(MiniTest::Unit::TestCase) do
|
33
|
+
def test_test1; assert true end
|
34
|
+
def test_test2; assert false end # oh noes!
|
35
|
+
def test_test3; assert true end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
Object.const_set(:ATestCase, tc1)
|
40
|
+
ATestCase.const_set(:Nested, tc2)
|
41
|
+
|
42
|
+
assert_equal %w(test_test3 test_test1), ATestCase.test_methods
|
43
|
+
assert_equal %w(test_test1 test_test3), ATestCase::Nested.test_methods
|
44
|
+
|
45
|
+
@tu.run %w[--seed 42 --verbose]
|
46
|
+
|
47
|
+
expected = <<-EOM.gsub(/^ {8}/, '')
|
48
|
+
Run options: --seed 42 --verbose
|
49
|
+
|
50
|
+
# Running tests:
|
51
|
+
|
52
|
+
ATestCase#test_test1 = 0.00 s = .
|
53
|
+
ATestCase#test_test3 = 0.00 s = .
|
54
|
+
ATestCase::Nested#test_test1 = 0.00 s = .
|
55
|
+
ATestCase::Nested#test_test3 = 0.00 s = .
|
56
|
+
|
57
|
+
|
58
|
+
Finished tests in 0.00
|
59
|
+
|
60
|
+
4 tests, 4 assertions, 0 failures, 0 errors, 0 skips
|
61
|
+
EOM
|
62
|
+
assert_report expected
|
63
|
+
end
|
64
|
+
ensure
|
65
|
+
MiniTest::Unit::TestCase::EXCLUDE_DIR.replace(old_exclude_base)
|
66
|
+
end
|
67
|
+
end
|
metadata
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: minitest-excludes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ryan Davis
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain:
|
17
|
+
- |
|
18
|
+
-----BEGIN CERTIFICATE-----
|
19
|
+
MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
20
|
+
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
21
|
+
GRYDY29tMB4XDTA5MDMwNjE4NTMxNVoXDTEwMDMwNjE4NTMxNVowRTETMBEGA1UE
|
22
|
+
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
23
|
+
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
24
|
+
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
25
|
+
taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
|
26
|
+
oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
|
27
|
+
GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
|
28
|
+
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
29
|
+
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
30
|
+
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
|
31
|
+
AQAY59gYvDxqSqgC92nAP9P8dnGgfZgLxP237xS6XxFGJSghdz/nI6pusfCWKM8m
|
32
|
+
vzjjH2wUMSSf3tNudQ3rCGLf2epkcU13/rguI88wO6MrE0wi4ZqLQX+eZQFskJb/
|
33
|
+
w6x9W1ur8eR01s397LSMexySDBrJOh34cm2AlfKr/jokKCTwcM0OvVZnAutaovC0
|
34
|
+
l1SVZ0ecg88bsWHA0Yhh7NFxK1utWoIhtB6AFC/+trM0FQEB/jZkIS8SaNzn96Rl
|
35
|
+
n0sZEf77FLf5peR8TP/PtmIg7Cyqz23sLM4mCOoTGIy5OcZ8TdyiyINUHtb5ej/T
|
36
|
+
FBHgymkyj/AOSqKRIpXPhjC6
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
|
39
|
+
date: 2011-12-21 00:00:00 Z
|
40
|
+
dependencies:
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
prerelease: false
|
44
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ~>
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
hash: 23
|
50
|
+
segments:
|
51
|
+
- 2
|
52
|
+
- 10
|
53
|
+
version: "2.10"
|
54
|
+
type: :runtime
|
55
|
+
version_requirements: *id001
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rdoc
|
58
|
+
prerelease: false
|
59
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ~>
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 19
|
65
|
+
segments:
|
66
|
+
- 3
|
67
|
+
- 10
|
68
|
+
version: "3.10"
|
69
|
+
type: :development
|
70
|
+
version_requirements: *id002
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: hoe
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ~>
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
hash: 27
|
80
|
+
segments:
|
81
|
+
- 2
|
82
|
+
- 12
|
83
|
+
version: "2.12"
|
84
|
+
type: :development
|
85
|
+
version_requirements: *id003
|
86
|
+
description: |-
|
87
|
+
minitest/excludes.rb extends MiniTest::Unit::TestCase to provide a
|
88
|
+
clean API for excluding certain tests you don't want to run under
|
89
|
+
certain conditions.
|
90
|
+
email:
|
91
|
+
- ryand-ruby@zenspider.com
|
92
|
+
executables: []
|
93
|
+
|
94
|
+
extensions: []
|
95
|
+
|
96
|
+
extra_rdoc_files:
|
97
|
+
- History.txt
|
98
|
+
- Manifest.txt
|
99
|
+
- README.txt
|
100
|
+
files:
|
101
|
+
- .autotest
|
102
|
+
- History.txt
|
103
|
+
- Manifest.txt
|
104
|
+
- README.txt
|
105
|
+
- Rakefile
|
106
|
+
- lib/minitest/excludes.rb
|
107
|
+
- test/metametameta.rb
|
108
|
+
- test/test_minitest_excludes.rb
|
109
|
+
- .gemtest
|
110
|
+
homepage: https://github.com/seattlerb/minitest-excludes
|
111
|
+
licenses: []
|
112
|
+
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options:
|
115
|
+
- --main
|
116
|
+
- README.txt
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
hash: 3
|
125
|
+
segments:
|
126
|
+
- 0
|
127
|
+
version: "0"
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
hash: 3
|
134
|
+
segments:
|
135
|
+
- 0
|
136
|
+
version: "0"
|
137
|
+
requirements: []
|
138
|
+
|
139
|
+
rubyforge_project: minitest-excludes
|
140
|
+
rubygems_version: 1.8.12
|
141
|
+
signing_key:
|
142
|
+
specification_version: 3
|
143
|
+
summary: minitest/excludes.rb extends MiniTest::Unit::TestCase to provide a clean API for excluding certain tests you don't want to run under certain conditions.
|
144
|
+
test_files:
|
145
|
+
- test/test_minitest_excludes.rb
|
metadata.gz.sig
ADDED