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(Debrew::Formula) if ARGV.debug?
|
||||
|
||||
env = ENV.to_hash
|
||||
|
||||
begin
|
||||
# tests can also return false to indicate failure
|
||||
Timeout::timeout TEST_TIMEOUT_SECONDS do
|
||||
@ -64,6 +66,8 @@ module Homebrew
|
||||
rescue Exception => e
|
||||
ofail "#{f.name}: failed"
|
||||
puts e, e.backtrace
|
||||
ensure
|
||||
ENV.replace(env)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user