dohtest 0.1.49 → 0.1.54
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/MIT-LICENSE +1 -1
- data/lib/dohtest/configure.rb +20 -5
- data/lib/dohtest/{require_paths.rb → find_files.rb} +4 -7
- data/lib/dohtest/load_test_files.rb +18 -0
- data/lib/dohtest/master_runner.rb +12 -13
- data/lib/dohtest/stream_output.rb +8 -2
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f671b0ee5564d932bd5cf2edd188c31292a0fee261a8ad5207e446450b93cb1e
|
4
|
+
data.tar.gz: 92e6b918b818a6e1b3824cde7e08c7964999a1e8088d024ed3f7b6ee2f365a14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98d77e960acc16540bd4e52588af6cb0a98c051d3d068b4cdd49632b247bc46ce164c55cffa0927622b0f28a01d33ab66f7ee171623e798da435203adacf75a3
|
7
|
+
data.tar.gz: 7a64336cbb411d9056253ba1e2c9ab8a0d99ed857ffea18751272a8ede1b38bc8838f04e2133caf53ed0ac4aa64753869a5cbcb49c08d7e354d332e00f07200b
|
data/MIT-LICENSE
CHANGED
data/lib/dohtest/configure.rb
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
require 'dohroot'
|
2
|
+
require 'dohtest/find_files'
|
2
3
|
|
3
4
|
module DohTest
|
4
5
|
extend self
|
5
6
|
|
6
7
|
def config
|
7
8
|
@config ||= {:post_all_callback => [], :pre_group_callback => [], :post_group_callback => [], :pre_test_callback => [],
|
8
|
-
:pre_each_callback => [], :post_each_callback => []}
|
9
|
+
:pre_each_callback => [], :post_each_callback => [], :pre_require_callback => []}
|
9
10
|
end
|
10
11
|
|
11
12
|
def find_root(start_directory, max_tries = 20)
|
12
13
|
curr_directory = start_directory
|
13
14
|
max_tries.times do
|
14
15
|
return nil if curr_directory == '/'
|
15
|
-
if File.
|
16
|
+
if (File.exist?(File.join(curr_directory, 'dohroot')) ||
|
17
|
+
File.directory?(File.join(curr_directory, 'test')) ||
|
18
|
+
File.exist?(File.join(curr_directory, 'dohtest.rb')))
|
16
19
|
return curr_directory
|
17
20
|
end
|
18
21
|
curr_directory = File.expand_path(File.join(curr_directory, '..'))
|
@@ -20,15 +23,18 @@ def find_root(start_directory, max_tries = 20)
|
|
20
23
|
nil
|
21
24
|
end
|
22
25
|
|
23
|
-
def
|
26
|
+
def load_configuration_file(start_path)
|
24
27
|
start_path = File.expand_path(start_path || '.')
|
25
28
|
if File.directory?(start_path)
|
26
29
|
start_directory = start_path
|
27
30
|
else
|
28
31
|
start_directory = File.dirname(start_path)
|
29
32
|
end
|
33
|
+
|
30
34
|
root_directory = find_root(start_directory)
|
31
|
-
|
35
|
+
if !root_directory
|
36
|
+
raise "unable to determine root directory to run tests from"
|
37
|
+
end
|
32
38
|
DohTest.config[:root] = root_directory
|
33
39
|
|
34
40
|
Doh.find_root_from_path(root_directory)
|
@@ -56,9 +62,18 @@ def add_default_config_values
|
|
56
62
|
DohTest.config[:seed] ||= (Time.new.to_f * 1000).to_i
|
57
63
|
end
|
58
64
|
|
65
|
+
def set_test_files
|
66
|
+
paths = DohTest.config[:paths]
|
67
|
+
if paths.empty?
|
68
|
+
paths = ['.']
|
69
|
+
end
|
70
|
+
DohTest.config[:test_files] = DohTest.find_files(DohTest.config[:glob], paths)
|
71
|
+
end
|
72
|
+
|
59
73
|
def configure(start_path)
|
60
74
|
add_default_config_values
|
61
|
-
|
75
|
+
set_test_files
|
76
|
+
load_configuration_file(start_path)
|
62
77
|
end
|
63
78
|
|
64
79
|
end
|
@@ -1,17 +1,14 @@
|
|
1
1
|
module DohTest
|
2
2
|
extend self
|
3
3
|
|
4
|
-
def
|
5
|
-
retval =
|
4
|
+
def find_files(glob, paths)
|
5
|
+
retval = []
|
6
6
|
expanded_paths = paths.map {|path| File.expand_path(path) }
|
7
7
|
expanded_paths.each do |path|
|
8
8
|
if File.directory?(path)
|
9
|
-
Dir.glob(File.join(path, '**', glob)).
|
10
|
-
retval = true
|
11
|
-
require(filename)
|
12
|
-
end
|
9
|
+
retval.concat(Dir.glob(File.join(path, '**', glob)).to_a)
|
13
10
|
else
|
14
|
-
|
11
|
+
retval << path
|
15
12
|
end
|
16
13
|
end
|
17
14
|
return retval
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module DohTest
|
2
|
+
extend self
|
3
|
+
|
4
|
+
def require_test_file(path, callbacks)
|
5
|
+
callbacks.each do |callback|
|
6
|
+
callback.call(path)
|
7
|
+
end
|
8
|
+
require(path)
|
9
|
+
end
|
10
|
+
|
11
|
+
def load_test_files(paths)
|
12
|
+
callbacks = @config[:pre_require_callback]
|
13
|
+
paths.each do |path|
|
14
|
+
require_test_file(path, callbacks)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -1,31 +1,30 @@
|
|
1
1
|
require 'dohtest/group_runner'
|
2
|
-
require 'dohtest/
|
2
|
+
require 'dohtest/load_test_files'
|
3
3
|
|
4
4
|
module DohTest
|
5
5
|
|
6
6
|
class MasterRunner
|
7
|
-
def initialize(output, config
|
7
|
+
def initialize(output, config)
|
8
8
|
@output = output
|
9
9
|
@config = config
|
10
|
-
# temporary for ease of transition
|
11
|
-
@config[:paths] ||= paths
|
12
10
|
end
|
13
11
|
|
14
12
|
def run
|
15
13
|
start_time = Time.now
|
14
|
+
srand(@config[:seed])
|
15
|
+
@output.run_begin(@config)
|
16
|
+
|
17
|
+
if @config[:test_files].empty?
|
18
|
+
@output.no_tests_found
|
19
|
+
return 1
|
20
|
+
end
|
21
|
+
|
22
|
+
DohTest.load_test_files(@config[:test_files])
|
23
|
+
|
16
24
|
@config[:pre_test_callback].each do |callback|
|
17
25
|
callback.call(@output)
|
18
26
|
end
|
19
|
-
if @config[:paths].empty?
|
20
|
-
unless DohTest.require_paths(@config[:glob], ['.'])
|
21
|
-
DohTest.require_paths(@config[:glob], [@config[:root]])
|
22
|
-
end
|
23
|
-
else
|
24
|
-
DohTest.require_paths(@config[:glob], @config[:paths])
|
25
|
-
end
|
26
27
|
|
27
|
-
srand(@config[:seed])
|
28
|
-
@output.run_begin(@config)
|
29
28
|
total_problems = 0
|
30
29
|
# sort them to be the same order no matter what (different machines were returning different results)
|
31
30
|
TestGroup.descendants.sort{|a,b|a.to_s<=>b.to_s}.shuffle.each do |group_class|
|
@@ -16,9 +16,11 @@ class StreamOutput
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def run_begin(config)
|
19
|
-
|
20
|
-
|
19
|
+
display_config = config.dup
|
20
|
+
display_config.delete(:test_files)
|
21
|
+
@std_ios.puts "running tests with config: #{display_config}"
|
21
22
|
|
23
|
+
@config = config
|
22
24
|
has_terminal = @std_ios.tty?
|
23
25
|
@no_color = !has_terminal || @config[:no_color]
|
24
26
|
@verbose = (has_terminal && !@config[:quiet]) || @config[:verbose]
|
@@ -127,6 +129,10 @@ class StreamOutput
|
|
127
129
|
@assertions_passed += 1
|
128
130
|
end
|
129
131
|
|
132
|
+
def no_tests_found
|
133
|
+
@err_ios.puts("\nno tests found")
|
134
|
+
end
|
135
|
+
|
130
136
|
private
|
131
137
|
def colorize(type, msg)
|
132
138
|
return msg if @no_color
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dohtest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.54
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
- Kem Mason
|
7
|
+
- ATPSoft
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2021-07-03 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: dohroot
|
@@ -58,9 +57,10 @@ files:
|
|
58
57
|
- lib/dohtest/capture_output.rb
|
59
58
|
- lib/dohtest/configure.rb
|
60
59
|
- lib/dohtest/failure.rb
|
60
|
+
- lib/dohtest/find_files.rb
|
61
61
|
- lib/dohtest/group_runner.rb
|
62
|
+
- lib/dohtest/load_test_files.rb
|
62
63
|
- lib/dohtest/master_runner.rb
|
63
|
-
- lib/dohtest/require_paths.rb
|
64
64
|
- lib/dohtest/stream_output.rb
|
65
65
|
- lib/dohtest/test_group.rb
|
66
66
|
- test/test_backtrace_parser.rb
|
@@ -77,15 +77,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
77
|
requirements:
|
78
78
|
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version: 2.
|
80
|
+
version: 2.6.0
|
81
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
83
|
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
requirements: []
|
87
|
-
|
88
|
-
rubygems_version: 2.6.13
|
87
|
+
rubygems_version: 3.2.11
|
89
88
|
signing_key:
|
90
89
|
specification_version: 4
|
91
90
|
summary: minimalist unit test framework
|