Add timeout for all specs.
This commit is contained in:
parent
8d148b1fbc
commit
4bc174cc62
@ -29,6 +29,7 @@ require "rubocop"
|
|||||||
require "rubocop/rspec/support"
|
require "rubocop/rspec/support"
|
||||||
require "find"
|
require "find"
|
||||||
require "byebug"
|
require "byebug"
|
||||||
|
require "timeout"
|
||||||
|
|
||||||
$LOAD_PATH.push(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/test/support/lib"))
|
$LOAD_PATH.push(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/test/support/lib"))
|
||||||
|
|
||||||
@ -181,7 +182,19 @@ RSpec.configure do |config|
|
|||||||
$stderr.reopen(File::NULL)
|
$stderr.reopen(File::NULL)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
timeout = example.metadata.fetch(:timeout, 60)
|
||||||
|
inner_timeout = nil
|
||||||
|
Timeout.timeout(timeout) do
|
||||||
example.run
|
example.run
|
||||||
|
rescue Timeout::Error => e
|
||||||
|
inner_timeout = e
|
||||||
|
end
|
||||||
|
rescue Timeout::Error
|
||||||
|
raise "Example exceeded maximum runtime of #{timeout} seconds."
|
||||||
|
end
|
||||||
|
|
||||||
|
raise inner_timeout if inner_timeout
|
||||||
rescue SystemExit => e
|
rescue SystemExit => e
|
||||||
raise "Unexpected exit with status #{e.status}."
|
raise "Unexpected exit with status #{e.status}."
|
||||||
ensure
|
ensure
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user