deep_test 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -36,7 +36,7 @@ Gem::manage_gems
36
36
  specification = Gem::Specification.new do |s|
37
37
  s.name = "deep_test"
38
38
  s.summary = "DeepTest runs tests in multiple processes."
39
- s.version = "1.0.0"
39
+ s.version = "1.0.1"
40
40
  s.author = "anonymous z, Dan Manges, David Vollbracht"
41
41
  s.description = s.summary
42
42
  s.email = "daniel.manges@gmail.com"
@@ -15,12 +15,13 @@ module DeepTest
15
15
  supervisor = DeepTest::Supervisor.new blackboard
16
16
  supervised_suite = DeepTest::SupervisedTestSuite.new(suite, supervisor)
17
17
  require 'test/unit/ui/console/testrunner'
18
- Test::Unit::UI::Console::TestRunner.run(supervised_suite, Test::Unit::UI::NORMAL)
18
+ result = Test::Unit::UI::Console::TestRunner.run(supervised_suite, Test::Unit::UI::NORMAL)
19
19
  Test::Unit.run = true
20
- end
20
+ return result.passed?
21
+ end
21
22
  end
22
23
  end
23
24
 
24
25
  if __FILE__ == $0
25
- DeepTest::Loader.run ARGV
26
+ exit DeepTest::Loader.run(ARGV)
26
27
  end
@@ -1,20 +1,16 @@
1
1
  module DeepTest
2
2
  class RindaBlackboard
3
- def initialize
4
- require "rinda/ring"
5
- DRb.start_service
6
- ring_server = Rinda::RingFinger.primary
7
- ts = ring_server.read([:name, :TupleSpace, nil, nil])[2]
8
- @tuple_space = Rinda::TupleSpaceProxy.new ts
3
+ def initialize(tuple_space = TupleSpaceFactory.tuple_space)
4
+ @tuple_space = tuple_space
9
5
  end
10
-
6
+
11
7
  def take_result
12
- result = @tuple_space.take ["test_result", nil], 3
8
+ result = @tuple_space.take ["test_result", nil], 30
13
9
  result[1]
14
10
  end
15
11
 
16
12
  def take_test
17
- tuple = @tuple_space.take(["run_test", nil, nil])
13
+ tuple = @tuple_space.take ["run_test", nil, nil], 30
18
14
  eval(tuple[1]).new(tuple[2])
19
15
  end
20
16
 
@@ -25,5 +21,15 @@ module DeepTest
25
21
  def write_test(test_case)
26
22
  @tuple_space.write ["run_test", test_case.class.to_s, test_case.method_name]
27
23
  end
24
+
25
+ class TupleSpaceFactory
26
+ def self.tuple_space
27
+ require "rinda/ring"
28
+ DRb.start_service
29
+ ring_server = Rinda::RingFinger.primary
30
+ ts = ring_server.read([:name, :TupleSpace, nil, nil])[2]
31
+ Rinda::TupleSpaceProxy.new ts
32
+ end
33
+ end
28
34
  end
29
35
  end
@@ -2,7 +2,7 @@ module DeepTest
2
2
  module StartWorkers
3
3
  def self.run(args)
4
4
  processes, pattern = args
5
- 1.to_i.times do
5
+ processes.to_i.times do
6
6
  Daemons.run_proc "deep_test_worker", :multiple => true, :ARGV => ["start"], :backtrace => true, :log_output => true do
7
7
  require "deep_test"
8
8
  ENV["RAILS_ENV"] = "test"
data/lib/deep_test.rb CHANGED
@@ -8,7 +8,6 @@ require "deep_test/extensions/testresult"
8
8
  require "deep_test/extensions/error"
9
9
  require "deep_test/extensions/object_extension"
10
10
 
11
- # require "deep_test/loader"
12
11
  require "deep_test/rinda_blackboard"
13
12
  require "deep_test/server"
14
13
  require "deep_test/simple_test_blackboard"
@@ -1,7 +1,8 @@
1
- # require File.dirname(__FILE__) + "/../test_helper"
2
- #
3
- # unit_tests do
4
- # test "no filters constant has empty filters" do
5
- # assert_equal [], DeepTest::Loader::NO_FILTERS.filters
6
- # end
7
- # end
1
+ require File.dirname(__FILE__) + "/../test_helper"
2
+ require "deep_test/loader" unless defined?(DeepTest::Loader)
3
+
4
+ unit_tests do
5
+ test "no filters constant has empty filters" do
6
+ assert_equal [], DeepTest::Loader::NO_FILTERS.filters
7
+ end
8
+ end
@@ -0,0 +1,15 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ unit_tests do
4
+ test "take result waits 30 seconds before timing out" do
5
+ blackboard = DeepTest::RindaBlackboard.new(tuple_space = stub)
6
+ tuple_space.expects(:take).with(["test_result", nil], 30).returns([])
7
+ blackboard.take_result
8
+ end
9
+
10
+ test "take test waits 30 seconds before timing out" do
11
+ blackboard = DeepTest::RindaBlackboard.new(tuple_space = stub)
12
+ tuple_space.expects(:take).with(["run_test", nil, nil], 30).returns([nil, "String", "foo"])
13
+ blackboard.take_test
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+ require "deep_test/start_workers"
3
+
4
+ unit_tests do
5
+ test "can specify number of processes to start" do
6
+ Daemons.expects(:run_proc).times(3)
7
+ DeepTest::StartWorkers.run [3, "pattern"]
8
+ end
9
+ end
data/test/test_helper.rb CHANGED
@@ -2,6 +2,7 @@ require 'rubygems'
2
2
  require 'test/unit'
3
3
  require 'dust'
4
4
  require 'mocha'
5
+ require 'daemons'
5
6
  $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + "/lib")
6
7
  require "deep_test"
7
8
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.3
3
3
  specification_version: 1
4
4
  name: deep_test
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.0
7
- date: 2007-09-04 00:00:00 -04:00
6
+ version: 1.0.1
7
+ date: 2007-09-06 00:00:00 -04:00
8
8
  summary: DeepTest runs tests in multiple processes.
9
9
  require_paths:
10
10
  - lib
@@ -52,6 +52,8 @@ files:
52
52
  - test/testresult_test.rb
53
53
  - test/worker_test.rb
54
54
  - test/deep_test/loader_test.rb
55
+ - test/deep_test/rinda_blackboard_test.rb
56
+ - test/deep_test/start_workers_test.rb
55
57
  - CHANGELOG
56
58
  - README
57
59
  - Rakefile