Skip to content
Snippets Groups Projects
Commit b61528e7 authored by Jack Nagel's avatar Jack Nagel
Browse files

Save and restore ENV around test invocations

This prevents mutations that happen in individual tests from leaking
into other tests.
parent 1b74a4f5
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment