Merge pull request #1515 from alyssais/formula_cache

Fix flaky tests.
This commit is contained in:
Mike McQuaid 2016-11-18 15:37:49 +00:00 committed by GitHub
commit 7853406fb4
4 changed files with 11 additions and 6 deletions

View File

@ -1337,10 +1337,14 @@ class Formula
end end
end end
# Clear caches of .racks and .installed. # Clear cache of .racks
# @private def self.clear_racks_cache
def self.clear_cache
@racks = nil @racks = nil
end
# Clear caches of .racks and .installed.
def self.clear_installed_formulae_cache
clear_racks_cache
@installed = nil @installed = nil
end end

View File

@ -317,6 +317,10 @@ class Tab < OpenStruct
end end
def write def write
# If this is a new installation, the cache of installed formulae
# will no longer be valid.
Formula.clear_installed_formulae_cache unless tabfile.exist?
CACHE[tabfile] = self CACHE[tabfile] = self
tabfile.atomic_write(to_json) tabfile.atomic_write(to_json)
end end

View File

@ -327,7 +327,6 @@ class InstalledDependantsTests < LinkTests
f = stub_formula_name(name) f = stub_formula_name(name)
keg = super keg = super
Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write
Formula.clear_cache
keg keg
end end

View File

@ -34,13 +34,11 @@ class UninstallTests < Homebrew::TestCase
end end
def test_check_for_testball_f2s_when_developer def test_check_for_testball_f2s_when_developer
skip "Flaky test"
assert_match "Warning", handle_unsatisfied_dependents assert_match "Warning", handle_unsatisfied_dependents
refute_predicate Homebrew, :failed? refute_predicate Homebrew, :failed?
end end
def test_check_for_dependents_when_not_developer def test_check_for_dependents_when_not_developer
skip "Flaky test"
run_as_not_developer do run_as_not_developer do
assert_match "Error", handle_unsatisfied_dependents assert_match "Error", handle_unsatisfied_dependents
assert_predicate Homebrew, :failed? assert_predicate Homebrew, :failed?