Fix brew test when conflicting minitest gems are installed
This commit is contained in:
parent
ea203c2aac
commit
2122620d71
@ -2,16 +2,23 @@ require 'extend/ENV'
|
|||||||
require 'hardware'
|
require 'hardware'
|
||||||
require 'keg'
|
require 'keg'
|
||||||
require 'timeout'
|
require 'timeout'
|
||||||
require 'test/unit/assertions'
|
|
||||||
|
|
||||||
module Homebrew extend self
|
module Homebrew extend self
|
||||||
TEST_TIMEOUT_SECONDS = 5*60
|
TEST_TIMEOUT_SECONDS = 5*60
|
||||||
|
|
||||||
if Object.const_defined?(:Minitest)
|
if defined?(Gem)
|
||||||
FailedAssertion = Minitest::Assertion
|
begin
|
||||||
elsif Object.const_defined?(:MiniTest)
|
gem "minitest", "< 5.0.0"
|
||||||
FailedAssertion = MiniTest::Assertion
|
rescue Gem::LoadError
|
||||||
|
require "test/unit/assertions"
|
||||||
|
FailedAssertion = Test::Unit::AssertionFailedError
|
||||||
|
else
|
||||||
|
require "minitest/unit"
|
||||||
|
require "test/unit/assertions"
|
||||||
|
FailedAssertion = MiniTest::Assertion
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
require "test/unit/assertions"
|
||||||
FailedAssertion = Test::Unit::AssertionFailedError
|
FailedAssertion = Test::Unit::AssertionFailedError
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -35,6 +42,9 @@ module Homebrew extend self
|
|||||||
end
|
end
|
||||||
|
|
||||||
puts "Testing #{f.name}"
|
puts "Testing #{f.name}"
|
||||||
|
|
||||||
|
f.extend(Test::Unit::Assertions)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
# tests can also return false to indicate failure
|
# tests can also return false to indicate failure
|
||||||
Timeout::timeout TEST_TIMEOUT_SECONDS do
|
Timeout::timeout TEST_TIMEOUT_SECONDS do
|
||||||
|
|||||||
@ -491,8 +491,6 @@ class Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test
|
def test
|
||||||
require 'test/unit/assertions'
|
|
||||||
extend(Test::Unit::Assertions)
|
|
||||||
# Adding the used options allows us to use `build.with?` inside of tests
|
# Adding the used options allows us to use `build.with?` inside of tests
|
||||||
tab = Tab.for_name(name)
|
tab = Tab.for_name(name)
|
||||||
tab.used_options.each { |opt| build.args << opt unless build.has_opposite_of? opt }
|
tab.used_options.each { |opt| build.args << opt unless build.has_opposite_of? opt }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user