ZenTest 4.4.2 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- �;7��2D+q�&��Z?�J��9?��Nˢ:(_Vx��5RS�
2
- ��4|F,��g(rg���P�8,���3%�+��;�u���;�� ����m�J]��b�0�B#[cwQ����K�ɜ����W_�]x��v����������+oZ�m�"�zT�a�=�ztW�\�&r����ߧ2�b� ��R�(���k?� |��c@�M�փ�?��¾�(4J�\V�����[L��sw��*�<�/� o��Vs
1
+ �����J�Z��<�bFG�NS��&7��#)u~��p'���Ѝb���H1�i���kw�L�Tw#�2��k��{MK�����8 �{��Z�D[�����P��b3�Ǹ��7Ȗ�����%���*�/{��k@ڀ�����2�b�� C���=�W&/��d9��
2
+ A��^���pDO4��Z{ʤp�hz��\���l�f��
3
+ c�W�eԐ#6e�O��*%..��2,ij �9n�a��a׶�z� WhK��H
File without changes
@@ -1,3 +1,22 @@
1
+ === 4.5.0 / 2011-02-18
2
+
3
+ * 6 minor enhancements:
4
+
5
+ * Added autotest -w flag to turn on warnings. Turned off warnings by default.
6
+ * Added autotest/preload.rb to deal with rails being egregiously slow.
7
+ * Added child process handling/cleanup on signals.
8
+ * Added postinitialize hook.
9
+ * Improved restart mechanism to include all flags.
10
+ * Refactored restart plugin to Autotest#restart.
11
+
12
+ * 5 bug fixes:
13
+
14
+ * Added sigquit handler to restart app straight up.
15
+ * Fixed autotest/isolate so it works
16
+ * Fixed parse_options to take args array (default ARGV) and to be non-destructive.
17
+ * Strip ascii color to avoid false positives. (graemeworthy)
18
+ * Use RbConfig to remove warning
19
+
1
20
  === 4.4.2 / 2010-12-10
2
21
 
3
22
  * 2 bug fixes:
@@ -21,6 +21,7 @@ lib/autotest/autoupdate.rb
21
21
  lib/autotest/bundler.rb
22
22
  lib/autotest/isolate.rb
23
23
  lib/autotest/once.rb
24
+ lib/autotest/preload.rb
24
25
  lib/autotest/rcov.rb
25
26
  lib/autotest/restart.rb
26
27
  lib/autotest/timestamp.rb
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- $-w = true
3
2
 
4
3
  require 'autotest'
5
4
 
@@ -62,8 +62,9 @@ class Autotest
62
62
 
63
63
  T0 = Time.at 0
64
64
 
65
- ALL_HOOKS = [ :all_good, :died, :green, :initialize, :interrupt, :quit,
66
- :ran_command, :red, :reset, :run_command, :updated, :waiting ]
65
+ ALL_HOOKS = [ :all_good, :died, :green, :initialize,
66
+ :post_initialize, :interrupt, :quit, :ran_command,
67
+ :red, :reset, :run_command, :updated, :waiting ]
67
68
 
68
69
  def self.options
69
70
  @@options ||= {}
@@ -81,7 +82,7 @@ class Autotest
81
82
 
82
83
  @@discoveries = []
83
84
 
84
- def self.parse_options
85
+ def self.parse_options args = ARGV
85
86
  require 'optparse'
86
87
  options = {}
87
88
  OptionParser.new do |opts|
@@ -125,11 +126,15 @@ class Autotest
125
126
  options[:style] = Array(style)
126
127
  end
127
128
 
129
+ opts.on("-w", "--warnings", "Turn on ruby warnings") do
130
+ $-w = true
131
+ end
132
+
128
133
  opts.on "-h", "--help", "Show this." do
129
134
  puts opts
130
135
  exit 1
131
136
  end
132
- end.parse!
137
+ end.parse args
133
138
 
134
139
  Autotest.options.merge! options
135
140
 
@@ -268,6 +273,7 @@ class Autotest
268
273
  # add/remove/clear accessor methods
269
274
  @exception_list = []
270
275
  @test_mappings = []
276
+ @child = nil
271
277
 
272
278
  self.completed_re =
273
279
  /\d+ tests, \d+ assertions, \d+ failures, \d+ errors(, \d+ skips)?/
@@ -312,6 +318,8 @@ class Autotest
312
318
 
313
319
  def run
314
320
  hook :initialize
321
+ hook :post_initialize
322
+
315
323
  reset
316
324
  add_sigint_handler
317
325
 
@@ -402,6 +410,8 @@ class Autotest
402
410
 
403
411
  def add_sigint_handler
404
412
  trap 'INT' do
413
+ Process.kill "KILL", @child if @child
414
+
405
415
  if self.interrupted then
406
416
  self.wants_to_quit = true
407
417
  else
@@ -415,6 +425,32 @@ class Autotest
415
425
  end
416
426
  end
417
427
 
428
+ ##
429
+ # Installs a sigquit handler
430
+
431
+ def add_sigquit_handler
432
+ trap 'QUIT' do
433
+ restart
434
+ end
435
+ end
436
+
437
+ def restart
438
+ Process.kill "KILL", @child if @child
439
+
440
+ cmd = [$0, *ARGV]
441
+
442
+ index = $LOAD_PATH.index RbConfig::CONFIG["sitelibdir"]
443
+
444
+ if index then
445
+ extra = $LOAD_PATH[0...index]
446
+ cmd = [Gem.ruby, "-I", extra.join(":")] + cmd
447
+ end
448
+
449
+ puts cmd.join(" ") if options[:verbose]
450
+
451
+ exec(*cmd)
452
+ end
453
+
418
454
  ##
419
455
  # If there are no files left to test (because they've all passed),
420
456
  # then all is good.
@@ -521,6 +557,7 @@ class Autotest
521
557
  # there are failures record this.
522
558
 
523
559
  def handle_results results
560
+ results = results.gsub(/\e\[\d+m/, '') # strip ascii color
524
561
  failed = results.scan self.failed_results_re
525
562
  completed = results[self.completed_re]
526
563
 
@@ -629,8 +666,8 @@ class Autotest
629
666
 
630
667
  def ruby
631
668
  ruby = ENV['RUBY']
632
- ruby ||= File.join(Config::CONFIG['bindir'],
633
- Config::CONFIG['ruby_install_name'])
669
+ ruby ||= File.join(RbConfig::CONFIG['bindir'],
670
+ RbConfig::CONFIG['ruby_install_name'])
634
671
 
635
672
  ruby.gsub! File::SEPARATOR, File::ALT_SEPARATOR if File::ALT_SEPARATOR
636
673
 
@@ -798,4 +835,11 @@ class Autotest
798
835
  def self.add_hook name, &block
799
836
  HOOKS[name] << block
800
837
  end
838
+
839
+ add_hook :died do |at, args|
840
+ err = *args
841
+ warn "Unhandled exception: #{err}"
842
+ warn err.backtrace.join("\n ")
843
+ warn "Quitting"
844
+ end
801
845
  end
@@ -9,7 +9,7 @@ module Autotest::Isolate
9
9
  end
10
10
 
11
11
  Autotest.add_hook :initialize do |at|
12
- ENV["GEM_PATH"] = dir
12
+ ENV["GEM_PATH"] = @@dir
13
13
  ENV["PATH"] += ":#{@@dir}/bin"
14
14
 
15
15
  Gem.clear_paths
@@ -0,0 +1,56 @@
1
+ module Autotest::Preload
2
+ def self.glob
3
+ @glob
4
+ end
5
+
6
+ def self.glob= o
7
+ @glob = o
8
+ end
9
+
10
+ self.glob = "test/test_helper.rb"
11
+
12
+ Autotest.add_hook :post_initialize do |at, *args|
13
+ at.add_sigquit_handler
14
+
15
+ warn "pre-loading initializers"
16
+ t0 = Time.now
17
+ Dir[self.glob].each do |path|
18
+ require path
19
+ end
20
+ warn "done pre-loading initializers in %.2f seconds" % [Time.now - t0]
21
+
22
+ false
23
+ end
24
+ end
25
+
26
+ class Autotest
27
+ alias :old_run_tests :run_tests
28
+
29
+ def run_tests
30
+ hook :run_command
31
+
32
+ new_mtime = self.find_files_to_test
33
+ return unless new_mtime
34
+ self.last_mtime = new_mtime
35
+
36
+ begin
37
+ # TODO: deal with unit_diff and partial test runs later
38
+ original_argv = ARGV.dup
39
+ ARGV.clear
40
+
41
+ @child = fork do
42
+ trap "QUIT", "DEFAULT"
43
+ trap "INT", "DEFAULT"
44
+ files_to_test.keys.each do |file|
45
+ load file
46
+ end
47
+ end
48
+ Process.wait
49
+ ensure
50
+ @child = nil
51
+ ARGV.replace original_argv
52
+ end
53
+
54
+ hook :ran_command
55
+ end
56
+ end
@@ -2,11 +2,7 @@ module Autotest::Restart
2
2
  Autotest.add_hook :updated do |at, *args|
3
3
  if args.flatten.include? ".autotest" then
4
4
  warn "Detected change to .autotest, restarting"
5
- cmd = %w(autotest)
6
- cmd << " -v" if $v
7
- cmd += ARGV
8
-
9
- exec(*cmd)
5
+ at.restart
10
6
  end
11
7
  end
12
8
  end
@@ -45,7 +45,7 @@ require 'open-uri'
45
45
  module Multiruby
46
46
  def self.env name, fallback; ENV[name] || fallback; end # :nodoc:
47
47
 
48
- TAGS = %w( 1_8_6 1_8_7 1_9_1)
48
+ TAGS = %w( 1_8_6 1_8_7 1_9_1 1_9_2)
49
49
  BRANCHES = %w(1_8 1_8_6 1_8_7 trunk)
50
50
 
51
51
  VERSIONS = env('VERSIONS', TAGS.join(":").gsub(/_/, '.')).split(/:/)
@@ -53,7 +53,7 @@ end
53
53
 
54
54
  class ZenTest
55
55
 
56
- VERSION = '4.4.2'
56
+ VERSION = '4.5.0'
57
57
 
58
58
  include ZenTestMapping
59
59
 
@@ -30,7 +30,7 @@ class TestAutotest < MiniTest::Unit::TestCase
30
30
 
31
31
  alias :deny :refute
32
32
 
33
- RUBY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']) unless defined? RUBY
33
+ RUBY = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']) unless defined? RUBY
34
34
 
35
35
  def setup
36
36
  @test_class = 'TestBlah'
@@ -285,6 +285,23 @@ Finished in 0.001655 seconds.
285
285
  exp = { "tests" => 12, "assertions" => 18, "failures" => 0, "errors" => 0 }
286
286
  assert_equal exp, @a.latest_results
287
287
 
288
+ # when colours are in the error message
289
+ color_error = "
290
+ 1) \e[31mFailure:\e[0m
291
+ test_fail1(#{@test_class}) [#{@test}:59]:
292
+ 2) \e[31mFailure:\e[0m
293
+ test_fail2(#{@test_class}) [#{@test}:60]:
294
+ 3) \e[31mError:\e[0m
295
+ test_error1(#{@test_class}):
296
+ 3) \e[31mError:\e[0m
297
+ test_error2(#{@test_class}):
298
+
299
+ 12 tests, 18 assertions, 2 failures, 2 errors
300
+ "
301
+ @a.handle_results(color_error)
302
+ assert @a.tainted
303
+
304
+
288
305
  s2 = "
289
306
  1) Failure:
290
307
  test_fail1(#{@test_class}) [#{@test}:59]:
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ZenTest
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 43
5
+ prerelease:
5
6
  segments:
6
7
  - 4
7
- - 4
8
- - 2
9
- version: 4.4.2
8
+ - 5
9
+ - 0
10
+ version: 4.5.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Ryan Davis
@@ -36,35 +37,39 @@ cert_chain:
36
37
  FBHgymkyj/AOSqKRIpXPhjC6
37
38
  -----END CERTIFICATE-----
38
39
 
39
- date: 2010-12-10 00:00:00 -08:00
40
+ date: 2011-02-18 00:00:00 -08:00
40
41
  default_executable:
41
42
  dependencies:
42
43
  - !ruby/object:Gem::Dependency
43
44
  name: minitest
44
45
  prerelease: false
45
46
  requirement: &id001 !ruby/object:Gem::Requirement
47
+ none: false
46
48
  requirements:
47
49
  - - ">="
48
50
  - !ruby/object:Gem::Version
51
+ hash: 11
49
52
  segments:
50
53
  - 2
51
54
  - 0
52
- - 0
53
- version: 2.0.0
55
+ - 2
56
+ version: 2.0.2
54
57
  type: :development
55
58
  version_requirements: *id001
56
59
  - !ruby/object:Gem::Dependency
57
60
  name: hoe
58
61
  prerelease: false
59
62
  requirement: &id002 !ruby/object:Gem::Requirement
63
+ none: false
60
64
  requirements:
61
65
  - - ">="
62
66
  - !ruby/object:Gem::Version
67
+ hash: 41
63
68
  segments:
64
69
  - 2
65
- - 8
66
- - 0
67
- version: 2.8.0
70
+ - 9
71
+ - 1
72
+ version: 2.9.1
68
73
  type: :development
69
74
  version_requirements: *id002
70
75
  description: |-
@@ -128,6 +133,7 @@ files:
128
133
  - lib/autotest/bundler.rb
129
134
  - lib/autotest/isolate.rb
130
135
  - lib/autotest/once.rb
136
+ - lib/autotest/preload.rb
131
137
  - lib/autotest/rcov.rb
132
138
  - lib/autotest/restart.rb
133
139
  - lib/autotest/timestamp.rb
@@ -142,6 +148,7 @@ files:
142
148
  - test/test_unit_diff.rb
143
149
  - test/test_zentest.rb
144
150
  - test/test_zentest_mapping.rb
151
+ - .gemtest
145
152
  has_rdoc: true
146
153
  homepage: http://www.zenspider.com/ZSS/Products/ZenTest/
147
154
  licenses: []
@@ -153,23 +160,27 @@ rdoc_options:
153
160
  require_paths:
154
161
  - lib
155
162
  required_ruby_version: !ruby/object:Gem::Requirement
163
+ none: false
156
164
  requirements:
157
165
  - - ">="
158
166
  - !ruby/object:Gem::Version
167
+ hash: 3
159
168
  segments:
160
169
  - 0
161
170
  version: "0"
162
171
  required_rubygems_version: !ruby/object:Gem::Requirement
172
+ none: false
163
173
  requirements:
164
174
  - - ">="
165
175
  - !ruby/object:Gem::Version
176
+ hash: 3
166
177
  segments:
167
178
  - 0
168
179
  version: "0"
169
180
  requirements: []
170
181
 
171
182
  rubyforge_project: zentest
172
- rubygems_version: 1.3.6
183
+ rubygems_version: 1.4.2
173
184
  signing_key:
174
185
  specification_version: 3
175
186
  summary: "ZenTest provides 4 different tools: zentest, unit_diff, autotest, and multiruby"
metadata.gz.sig CHANGED
Binary file