aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/lib/config.rb5
-rw-r--r--Library/Homebrew/test/test_pathname.rb4
-rw-r--r--Library/Homebrew/test/test_sandbox.rb2
-rw-r--r--Library/Homebrew/test/testing_env.rb4
4 files changed, 10 insertions, 5 deletions
diff --git a/Library/Homebrew/test/lib/config.rb b/Library/Homebrew/test/lib/config.rb
index 86b652660..adf150c2e 100644
--- a/Library/Homebrew/test/lib/config.rb
+++ b/Library/Homebrew/test/lib/config.rb
@@ -1,7 +1,9 @@
require "tmpdir"
+HOMEBREW_TEMP = Pathname.new(ENV["HOMEBREW_TEMP"] || "/tmp")
+
TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") { |k|
- dir = Dir.mktmpdir("homebrew_tests")
+ dir = Dir.mktmpdir("homebrew_tests", HOMEBREW_TEMP)
at_exit { FileUtils.remove_entry(dir) }
ENV[k] = dir
}
@@ -13,4 +15,3 @@ HOMEBREW_CACHE = HOMEBREW_PREFIX.parent+"cache"
HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent+"formula_cache"
HOMEBREW_CELLAR = HOMEBREW_PREFIX.parent+"cellar"
HOMEBREW_LOGS = HOMEBREW_PREFIX.parent+"logs"
-HOMEBREW_TEMP = Pathname.new(ENV["HOMEBREW_TEMP"] || "/tmp")
diff --git a/Library/Homebrew/test/test_pathname.rb b/Library/Homebrew/test/test_pathname.rb
index 3db015967..caf650b5f 100644
--- a/Library/Homebrew/test/test_pathname.rb
+++ b/Library/Homebrew/test/test_pathname.rb
@@ -7,8 +7,8 @@ module PathnameTestExtension
include FileUtils
def setup
- @src = Pathname.new(Dir.mktmpdir)
- @dst = Pathname.new(Dir.mktmpdir)
+ @src = Pathname.new(mktmpdir)
+ @dst = Pathname.new(mktmpdir)
@file = @src+'foo'
@dir = @src+'bar'
end
diff --git a/Library/Homebrew/test/test_sandbox.rb b/Library/Homebrew/test/test_sandbox.rb
index 0e76d0b8c..2cf9c5106 100644
--- a/Library/Homebrew/test/test_sandbox.rb
+++ b/Library/Homebrew/test/test_sandbox.rb
@@ -5,7 +5,7 @@ class SandboxTest < Homebrew::TestCase
def setup
skip "sandbox not implemented" unless Sandbox.available?
@sandbox = Sandbox.new
- @dir = Pathname.new(Dir.mktmpdir)
+ @dir = Pathname.new(mktmpdir)
@file = @dir/"foo"
end
diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb
index 0e58afeea..d9a0329b4 100644
--- a/Library/Homebrew/test/testing_env.rb
+++ b/Library/Homebrew/test/testing_env.rb
@@ -91,6 +91,10 @@ module Homebrew
end
end
+ def mktmpdir(prefix_suffix=nil, &block)
+ Dir.mktmpdir(prefix_suffix, HOMEBREW_TEMP, &block)
+ end
+
def assert_nothing_raised
yield
end