deep_test 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,8 +1,12 @@
1
+ * 1.1.2 (February 9, 2008)
2
+
3
+ * Fix bug with run_test_suite script not exiting with correct exit code.
4
+
1
5
  * 1.1.1 (February 9, 2008)
2
6
 
3
7
  * No longer fork from Rake process.
4
8
 
5
- * 1.1.0
9
+ * 1.1.0 (December 23, 2007)
6
10
 
7
11
  * DeepTest::TestTask#processes= is now DeepTest::TestTask#number_of_workers=
8
12
  * No longer depend on the Daemons gem, use DeepTest::Warlock instead.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/contrib/sshpublisher'
6
6
  $LOAD_PATH << File.dirname(__FILE__) + "/lib"
7
7
  require "deep_test/rake_tasks"
8
8
 
9
- task :default => %w[test deep_test]
9
+ task :default => %w[test failing_test deep_test]
10
10
 
11
11
  Rake::TestTask.new do |t|
12
12
  t.pattern = "test/**/*_test.rb"
@@ -18,6 +18,22 @@ DeepTest::TestTask.new :deep_test do |t|
18
18
  t.pattern = "test/**/*_test.rb"
19
19
  end
20
20
 
21
+ DeepTest::TestTask.new :deep_test_failing do |t|
22
+ t.number_of_workers = 1
23
+ t.pattern = "test/failing.rb"
24
+ end
25
+
26
+ # TODO: figure out a better way to test this that doesn't
27
+ # involve having a failing test in the output of 'rake test'
28
+ task :failing_test do
29
+ exception = nil
30
+ begin
31
+ Rake::Task[:deep_test_failing].invoke
32
+ rescue => exception
33
+ end
34
+ fail "exception should not be nil" if exception.nil?
35
+ end
36
+
21
37
  desc "Generate documentation"
22
38
  Rake::RDocTask.new(:rdoc) do |rdoc|
23
39
  rdoc.rdoc_dir = "doc"
@@ -37,7 +53,7 @@ specification = Gem::Specification.new do |s|
37
53
  s.platform = Gem::Platform::RUBY
38
54
  s.name = "deep_test"
39
55
  s.summary = "DeepTest runs tests in multiple processes."
40
- s.version = "1.1.1"
56
+ s.version = "1.1.2"
41
57
  s.author = "anonymous z, Dan Manges, David Vollbracht"
42
58
  s.description = s.summary
43
59
  s.email = "daniel.manges@gmail.com"
@@ -8,9 +8,7 @@ module DeepTest
8
8
  def self.run
9
9
  require "deep_test"
10
10
  suite = Test::Unit::AutoRunner::COLLECTORS[:objectspace].call NO_FILTERS
11
- blackboard = DeepTest::RindaBlackboard.new
12
- supervisor = DeepTest::Supervisor.new blackboard
13
- supervised_suite = DeepTest::SupervisedTestSuite.new(suite, supervisor)
11
+ supervised_suite = DeepTest::SupervisedTestSuite.new(suite)
14
12
  require 'test/unit/ui/console/testrunner'
15
13
  result = Test::Unit::UI::Console::TestRunner.run(supervised_suite, Test::Unit::UI::NORMAL)
16
14
  Test::Unit.run = true
@@ -1,6 +1,6 @@
1
1
  module DeepTest
2
2
  class SupervisedTestSuite
3
- def initialize(suite, supervisor)
3
+ def initialize(suite, supervisor = DeepTest::Supervisor.new)
4
4
  @suite = suite
5
5
  @supervisor = supervisor
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module DeepTest
2
2
  class Supervisor
3
- def initialize(blackboard)
3
+ def initialize(blackboard = DeepTest::RindaBlackboard.new)
4
4
  @blackboard = blackboard
5
5
  @count = 0
6
6
  end
@@ -1,6 +1,6 @@
1
1
  module DeepTest
2
2
  class Worker
3
- def initialize(blackboard)
3
+ def initialize(blackboard = DeepTest::RindaBlackboard.new)
4
4
  @blackboard = blackboard
5
5
  end
6
6
 
@@ -11,27 +11,24 @@ begin
11
11
  warlock.start "server" do
12
12
  DeepTest::Server.start
13
13
  end
14
- sleep 0.25
14
+ sleep 0.25 # TODO: is this necessary?
15
15
 
16
16
  # workers
17
17
  number_of_workers.to_i.times do |i|
18
18
  warlock.start "worker #{i}" do
19
19
  srand # re-seed random numbers
20
20
  ActiveRecord::Base.connection.reconnect! if defined?(ActiveRecord::Base)
21
- blackboard = DeepTest::RindaBlackboard.new
22
- DeepTest::Worker.new(blackboard).run
21
+ DeepTest::Worker.new.run
23
22
  end
24
23
  end
25
24
 
26
- passed = false
27
25
  loader_pid = fork do
28
26
  puts "Loader (#{$$})"
29
27
  passed = DeepTest::Loader.run
30
28
  exit(passed ? 0 : 1)
31
29
  end
32
30
  Process.wait(loader_pid)
33
- passed = $?.success?
34
- passed
31
+ exit($?.success? ? 0 : 1)
35
32
  ensure
36
33
  warlock.stop_all if warlock
37
34
  end
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + "/test_helper"
2
+
3
+ unit_tests do
4
+ test "failing" do
5
+ assert false
6
+ end
7
+ end
@@ -54,4 +54,10 @@ unit_tests do
54
54
 
55
55
  assert_equal suite.size, supervised_suite.size
56
56
  end
57
+
58
+ test "defaults to using DeepTest::Supervisor" do
59
+ DeepTest::Supervisor.stubs(:new).returns(:supervisor)
60
+ supervised_suite = DeepTest::SupervisedTestSuite.new(stub)
61
+ assert_equal :supervisor, supervised_suite.instance_variable_get("@supervisor")
62
+ end
57
63
  end
@@ -71,4 +71,10 @@ unit_tests do
71
71
  supervisor.read_results Test::Unit::TestResult.new do |channel,name|
72
72
  end
73
73
  end
74
+
75
+ test "defaults to using a rinda blackboard" do
76
+ DeepTest::RindaBlackboard.stubs(:new).returns(:rinda_blackboard)
77
+ supervisor = DeepTest::Supervisor.new
78
+ assert_equal :rinda_blackboard, supervisor.instance_variable_get("@blackboard")
79
+ end
74
80
  end
@@ -55,4 +55,10 @@ unit_tests do
55
55
  test "does not fork from rake" do
56
56
  assert !defined?(Rake)
57
57
  end
58
+
59
+ test "defaults to using a rinda blackboard" do
60
+ DeepTest::RindaBlackboard.stubs(:new).returns(:rinda_blackboard)
61
+ worker = DeepTest::Worker.new
62
+ assert_equal :rinda_blackboard, worker.instance_variable_get("@blackboard")
63
+ end
58
64
  end
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: deep_test
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.1
6
+ version: 1.1.2
7
7
  date: 2008-02-09 00:00:00 -05:00
8
8
  summary: DeepTest runs tests in multiple processes.
9
9
  require_paths:
@@ -45,6 +45,7 @@ files:
45
45
  - lib/deep_test/extensions/object_extension.rb
46
46
  - lib/deep_test/extensions/testresult.rb
47
47
  - script/run_test_suite.rb
48
+ - test/failing.rb
48
49
  - test/simple_test_blackboard_test.rb
49
50
  - test/supervised_test_suite_test.rb
50
51
  - test/supervisor_test.rb