Save and restore ENV around test invocations
This prevents mutations that happen in individual tests from leaking into other tests.
This commit is contained in:
parent
1b74a4f5c2
commit
b61528e757
@ -53,6 +53,8 @@ module Homebrew
|
|||||||
f.extend(Homebrew::Assertions)
|
f.extend(Homebrew::Assertions)
|
||||||
f.extend(Debrew::Formula) if ARGV.debug?
|
f.extend(Debrew::Formula) if ARGV.debug?
|
||||||
|
|
||||||
|
env = ENV.to_hash
|
||||||
|
|
||||||
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
|
||||||
@ -64,6 +66,8 @@ module Homebrew
|
|||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
ofail "#{f.name}: failed"
|
ofail "#{f.name}: failed"
|
||||||
puts e, e.backtrace
|
puts e, e.backtrace
|
||||||
|
ensure
|
||||||
|
ENV.replace(env)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user