dohtest 0.1.50 → 0.1.51

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce812b03d63d1fa317beca3a8ea8246b8bfd9d4d
4
- data.tar.gz: db98a1adc045d4698833a296a4c3f407a9e0ca24
3
+ metadata.gz: c65ae8542671d9a70fcb9712dc9de692ba6d379d
4
+ data.tar.gz: b6a395e6f1ffb9977760d8941da898f9b68ce7b3
5
5
  SHA512:
6
- metadata.gz: cac3d18af47602b25d0f1cdd63e09f181b702c273b1e33bce4f971751d273a0f3ac939a4f14605528eb4e24cdaecd58e1f44434ef5b13fda0f905a22ffd5f099
7
- data.tar.gz: c9776a6ed6315b6bc181eed0e9e1e4381a733a577afe71952cf84ff88c3ea66042d3db6a631d20ee6bf67fefa64e880b259836f495c3c897178cdd112ea36285
6
+ metadata.gz: 581310decdb8a8e6c0d9a1feb9837ba4d3aae2e71009d628629c2da49a124bd13230470e0a592c2a97efb83a4b07d258757b471599ba233479ce763dc88c1890
7
+ data.tar.gz: 9261d2a26d5144a7cfffa99bda033b06e2f5bf2a1be6e971f51a287fb3a08595a1af3f0de1fe62b3f5148a53bed40e79ad972bcfa584afd4ee3857b4dc2c3d36
@@ -5,7 +5,7 @@ extend self
5
5
 
6
6
  def config
7
7
  @config ||= {:post_all_callback => [], :pre_group_callback => [], :post_group_callback => [], :pre_test_callback => [],
8
- :pre_each_callback => [], :post_each_callback => []}
8
+ :pre_each_callback => [], :post_each_callback => [], :pre_require_callback => []}
9
9
  end
10
10
 
11
11
  def find_root(start_directory, max_tries = 20)
@@ -20,15 +20,18 @@ def find_root(start_directory, max_tries = 20)
20
20
  nil
21
21
  end
22
22
 
23
- def load_configuration_files(start_path)
23
+ def load_configuration_file(start_path)
24
24
  start_path = File.expand_path(start_path || '.')
25
25
  if File.directory?(start_path)
26
26
  start_directory = start_path
27
27
  else
28
28
  start_directory = File.dirname(start_path)
29
29
  end
30
+
30
31
  root_directory = find_root(start_directory)
31
- raise "unable to determine root directory to run tests from" unless root_directory
32
+ if !root_directory
33
+ raise "unable to determine root directory to run tests from"
34
+ end
32
35
  DohTest.config[:root] = root_directory
33
36
 
34
37
  Doh.find_root_from_path(root_directory)
@@ -58,7 +61,7 @@ end
58
61
 
59
62
  def configure(start_path)
60
63
  add_default_config_values
61
- load_configuration_files(start_path)
64
+ load_configuration_file(start_path)
62
65
  end
63
66
 
64
67
  end
@@ -11,19 +11,22 @@ class MasterRunner
11
11
 
12
12
  def run
13
13
  start_time = Time.now
14
+ srand(@config[:seed])
15
+ @output.run_begin(@config)
16
+
17
+ paths = @config[:paths]
18
+ if paths.empty?
19
+ paths = ['.']
20
+ end
21
+ if !DohTest.require_paths(@config[:glob], paths)
22
+ @output.no_tests_found
23
+ return 1
24
+ end
25
+
14
26
  @config[:pre_test_callback].each do |callback|
15
27
  callback.call(@output)
16
28
  end
17
- if @config[:paths].empty?
18
- unless DohTest.require_paths(@config[:glob], ['.'])
19
- DohTest.require_paths(@config[:glob], [@config[:root]])
20
- end
21
- else
22
- DohTest.require_paths(@config[:glob], @config[:paths])
23
- end
24
29
 
25
- srand(@config[:seed])
26
- @output.run_begin(@config)
27
30
  total_problems = 0
28
31
  # sort them to be the same order no matter what (different machines were returning different results)
29
32
  TestGroup.descendants.sort{|a,b|a.to_s<=>b.to_s}.shuffle.each do |group_class|
@@ -1,17 +1,26 @@
1
1
  module DohTest
2
2
  extend self
3
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
+
4
11
  def require_paths(glob, paths)
5
12
  retval = false
6
13
  expanded_paths = paths.map {|path| File.expand_path(path) }
14
+ callbacks = @config[:pre_require_callback]
7
15
  expanded_paths.each do |path|
8
16
  if File.directory?(path)
9
17
  Dir.glob(File.join(path, '**', glob)).each do |filename|
10
18
  retval = true
11
- require(filename)
19
+ DohTest.require_test_file(filename, callbacks)
12
20
  end
13
21
  else
14
- require(path)
22
+ retval = true
23
+ DohTest.require_test_file(path, callbacks)
15
24
  end
16
25
  end
17
26
  return retval
@@ -127,6 +127,10 @@ class StreamOutput
127
127
  @assertions_passed += 1
128
128
  end
129
129
 
130
+ def no_tests_found
131
+ @err_ios.puts("\nno tests found")
132
+ end
133
+
130
134
  private
131
135
  def colorize(type, msg)
132
136
  return msg if @no_color
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dohtest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.50
4
+ version: 0.1.51
5
5
  platform: ruby
6
6
  authors:
7
7
  - Makani Mason
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-12-21 00:00:00.000000000 Z
12
+ date: 2017-12-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dohroot