aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2016-11-18 15:37:49 +0000
committerGitHub2016-11-18 15:37:49 +0000
commit7853406fb40f9b2785cef805e6f9a19183ae3017 (patch)
tree6b379e8060f54fe791430b57d2ecffd1be892c2d /Library
parentc3022ad2d50204d2b5058c712481362e4decc6d6 (diff)
parent3555206a7fe83adb5fe6f48f5e2e20400e8a6ae8 (diff)
downloadbrew-7853406fb40f9b2785cef805e6f9a19183ae3017.tar.bz2
Merge pull request #1515 from alyssais/formula_cache
Fix flaky tests.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb10
-rw-r--r--Library/Homebrew/tab.rb4
-rw-r--r--Library/Homebrew/test/keg_test.rb1
-rw-r--r--Library/Homebrew/test/uninstall_test.rb2
4 files changed, 11 insertions, 6 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 5ffe43374..7fe00cb45 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -1337,10 +1337,14 @@ class Formula
end
end
- # Clear caches of .racks and .installed.
- # @private
- def self.clear_cache
+ # Clear cache of .racks
+ def self.clear_racks_cache
@racks = nil
+ end
+
+ # Clear caches of .racks and .installed.
+ def self.clear_installed_formulae_cache
+ clear_racks_cache
@installed = nil
end
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index 1cabacefd..3bb7d8b62 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -317,6 +317,10 @@ class Tab < OpenStruct
end
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
tabfile.atomic_write(to_json)
end
diff --git a/Library/Homebrew/test/keg_test.rb b/Library/Homebrew/test/keg_test.rb
index fdc739c9d..2c91027e5 100644
--- a/Library/Homebrew/test/keg_test.rb
+++ b/Library/Homebrew/test/keg_test.rb
@@ -327,7 +327,6 @@ class InstalledDependantsTests < LinkTests
f = stub_formula_name(name)
keg = super
Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write
- Formula.clear_cache
keg
end
diff --git a/Library/Homebrew/test/uninstall_test.rb b/Library/Homebrew/test/uninstall_test.rb
index 70a694353..06b067886 100644
--- a/Library/Homebrew/test/uninstall_test.rb
+++ b/Library/Homebrew/test/uninstall_test.rb
@@ -34,13 +34,11 @@ class UninstallTests < Homebrew::TestCase
end
def test_check_for_testball_f2s_when_developer
- skip "Flaky test"
assert_match "Warning", handle_unsatisfied_dependents
refute_predicate Homebrew, :failed?
end
def test_check_for_dependents_when_not_developer
- skip "Flaky test"
run_as_not_developer do
assert_match "Error", handle_unsatisfied_dependents
assert_predicate Homebrew, :failed?