Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cutest doesn't fork anymore; use ENV var to pass driver

  • Loading branch information...
commit b51af6ce81527fe7f5cf9f72edce89781f304ba5 1 parent 24e8499
@pietern pietern authored
Showing with 20 additions and 27 deletions.
  1. +19 −27 Rakefile
  2. +1 −0  test/helper.rb
View
46 Rakefile
@@ -35,11 +35,6 @@ task :stop do
end
end
-def isolated(&block)
- pid = fork { yield }
- Process.wait(pid)
-end
-
desc "Run the test suite"
task :test => ["test:ruby", "test:hiredis", "test:synchrony"]
@@ -48,26 +43,23 @@ namespace :test do
task :ruby do
require "cutest"
- isolated do
- Cutest.run(Dir["./test/**/*_test.rb"])
- end
+ Cutest.run(Dir["./test/**/*_test.rb"])
end
desc "Run tests against the hiredis driver"
task :hiredis do
require "cutest"
- isolated do
- begin
- require "redis/connection/hiredis"
+ begin
+ require "redis/connection/hiredis"
- puts
- puts "Running tests against hiredis v#{Hiredis::VERSION}"
+ puts
+ puts "Running tests against hiredis v#{Hiredis::VERSION}"
- Cutest.run(Dir["./test/**/*_test.rb"])
- rescue LoadError
- puts "Skipping tests against hiredis"
- end
+ ENV["REDIS_CONNECTION_DRIVER"] = "hiredis"
+ Cutest.run(Dir["./test/**/*_test.rb"])
+ rescue LoadError
+ puts "Skipping tests against hiredis"
end
end
@@ -78,18 +70,18 @@ namespace :test do
# Synchrony needs 1.9
next if RUBY_VERSION < "1.9"
- isolated do
- begin
- require "redis/connection/synchrony"
+ begin
+ require "redis/connection/synchrony"
- puts
- puts "Running tests against em-synchrony"
+ puts
+ puts "Running tests against em-synchrony"
- threaded_tests = ['./test/thread_safety_test.rb']
- Cutest.run(Dir['./test/**/*_test.rb'] - threaded_tests)
- rescue LoadError
- puts "Skipping tests against em-synchrony"
- end
+ threaded_tests = ['./test/thread_safety_test.rb']
+
+ ENV["REDIS_CONNECTION_DRIVER"] = "synchrony"
+ Cutest.run(Dir['./test/**/*_test.rb'] - threaded_tests)
+ rescue LoadError
+ puts "Skipping tests against em-synchrony"
end
end
end
View
1  test/helper.rb
@@ -44,6 +44,7 @@ def init(redis)
$VERBOSE = true
+require "redis/connection/%s" % (ENV["REDIS_CONNECTION_DRIVER"] || "ruby")
require "redis"
def driver
Please sign in to comment.
Something went wrong with that request. Please try again.