Use array of constants to set up test directories.

This commit is contained in:
Markus Reiter 2016-12-09 17:27:31 +01:00
parent 01c1372074
commit e40c63f77c
4 changed files with 32 additions and 6 deletions

View File

@ -2,6 +2,7 @@ source "https://rubygems.org"
gem "mocha"
gem "minitest"
gem "minitest-reporters"
gem "parallel_tests"
group :coverage do

View File

@ -1,6 +1,8 @@
GEM
remote: https://rubygems.org/
specs:
ansi (1.5.0)
builder (3.2.3)
codecov (0.1.9)
json
simplecov
@ -9,11 +11,17 @@ GEM
json (2.0.3)
metaclass (0.0.4)
minitest (5.10.1)
minitest-reporters (1.1.14)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
mocha (1.2.1)
metaclass (~> 0.0.1)
parallel (1.10.0)
parallel_tests (2.13.0)
parallel
ruby-progressbar (1.8.1)
simplecov (0.13.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
@ -27,6 +35,7 @@ PLATFORMS
DEPENDENCIES
codecov
minitest
minitest-reporters
mocha
parallel_tests
simplecov

View File

@ -12,6 +12,20 @@ module Homebrew
TEST_SHA1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze
TEST_SHA256 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze
def before_setup
[
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-core/Formula",
HOMEBREW_CACHE,
HOMEBREW_CACHE_FORMULA,
HOMEBREW_LOCK_DIR,
HOMEBREW_CELLAR,
HOMEBREW_LOGS,
HOMEBREW_TEMP,
].each(&:mkpath)
super
end
def setup
super
@ -23,6 +37,10 @@ module Homebrew
ARGV.replace(@__argv)
ENV.replace(@__env)
super
end
def after_teardown
Tab.clear_cache
coretap = CoreTap.new

View File

@ -1,16 +1,14 @@
$:.unshift File.expand_path("../..", __FILE__)
$:.unshift File.expand_path("../support/lib", __FILE__)
$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew"))
$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_LIBRARY"]}/Homebrew/test/support/lib"))
require "simplecov" if ENV["HOMEBREW_TESTS_COVERAGE"]
require "global"
require "formulary"
# Test environment setup
(HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-core/Formula").mkpath
%w[cache formula_cache locks cellar logs temp].each { |d| HOMEBREW_PREFIX.parent.join(d).mkpath }
begin
require "minitest/autorun"
require "minitest/reporters"
Minitest::Reporters.use! Minitest::Reporters::DefaultReporter.new(color: true)
require "parallel_tests/test/runtime_logger"
require "mocha/setup"
rescue LoadError