diff options
| author | Alyssa Ross | 2017-01-21 11:21:30 +0000 |
|---|---|---|
| committer | Alyssa Ross | 2017-01-21 11:34:52 +0000 |
| commit | 70a381a00ff1e354e059aa07d55ebab90c5f874a (patch) | |
| tree | 32275fe167b961605ddeb2cf71fe1c1437d91c2a /Library/Homebrew/test/os | |
| parent | d7c463ad2c036bd9917398069217f6cad0f5b326 (diff) | |
| download | brew-70a381a00ff1e354e059aa07d55ebab90c5f874a.tar.bz2 | |
tests: enforce `super` in lifecycle hooks
This will allow us to have global setup and teardown for tests.
For example, we can automatically clear caches after each test, to avoid
annoying intermittent failures like #1879 and #1886.
Diffstat (limited to 'Library/Homebrew/test/os')
| -rw-r--r-- | Library/Homebrew/test/os/mac/bottle_collector_test.rb | 1 | ||||
| -rw-r--r-- | Library/Homebrew/test/os/mac/dependency_collector_test.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/os/mac/diagnostic_test.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/os/mac/keg_test.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/os/mac/mach_test.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/test/os/mac/version_test.rb | 1 |
6 files changed, 13 insertions, 0 deletions
diff --git a/Library/Homebrew/test/os/mac/bottle_collector_test.rb b/Library/Homebrew/test/os/mac/bottle_collector_test.rb index 2f88050ae..e9ae9b753 100644 --- a/Library/Homebrew/test/os/mac/bottle_collector_test.rb +++ b/Library/Homebrew/test/os/mac/bottle_collector_test.rb @@ -3,6 +3,7 @@ require "utils/bottles" class OSMacBottleCollectorTests < Homebrew::TestCase def setup + super @collector = Utils::Bottles::Collector.new end diff --git a/Library/Homebrew/test/os/mac/dependency_collector_test.rb b/Library/Homebrew/test/os/mac/dependency_collector_test.rb index 4fdf3ebe4..1033df9ab 100644 --- a/Library/Homebrew/test/os/mac/dependency_collector_test.rb +++ b/Library/Homebrew/test/os/mac/dependency_collector_test.rb @@ -7,11 +7,13 @@ class OSMacDependencyCollectorTests < Homebrew::TestCase end def setup + super @d = DependencyCollector.new end def teardown DependencyCollector.clear_cache + super end def test_tar_needs_xz_dependency diff --git a/Library/Homebrew/test/os/mac/diagnostic_test.rb b/Library/Homebrew/test/os/mac/diagnostic_test.rb index 655aa1d46..284d293ca 100644 --- a/Library/Homebrew/test/os/mac/diagnostic_test.rb +++ b/Library/Homebrew/test/os/mac/diagnostic_test.rb @@ -5,12 +5,14 @@ require "diagnostic" class OSMacDiagnosticChecksTest < Homebrew::TestCase def setup + super @env = ENV.to_hash @checks = Homebrew::Diagnostic::Checks.new end def teardown ENV.replace(@env) + super end def test_check_for_other_package_managers diff --git a/Library/Homebrew/test/os/mac/keg_test.rb b/Library/Homebrew/test/os/mac/keg_test.rb index e79cbc921..5f215bd06 100644 --- a/Library/Homebrew/test/os/mac/keg_test.rb +++ b/Library/Homebrew/test/os/mac/keg_test.rb @@ -6,6 +6,8 @@ class OSMacLinkTests < Homebrew::TestCase include FileUtils def setup + super + keg = HOMEBREW_CELLAR.join("foo", "1.0") keg.join("bin").mkpath @@ -34,6 +36,8 @@ class OSMacLinkTests < Homebrew::TestCase rmtree HOMEBREW_PREFIX/"bin" rmtree HOMEBREW_PREFIX/"lib" + + super end def test_mach_o_files_skips_hardlinks diff --git a/Library/Homebrew/test/os/mac/mach_test.rb b/Library/Homebrew/test/os/mac/mach_test.rb index a42f7316b..ed0424be6 100644 --- a/Library/Homebrew/test/os/mac/mach_test.rb +++ b/Library/Homebrew/test/os/mac/mach_test.rb @@ -109,6 +109,7 @@ end class ArchitectureListExtensionTests < MachOPathnameTests def setup + super @archs = [:i386, :x86_64, :ppc7400, :ppc64].extend(ArchitectureListExtension) end @@ -157,11 +158,13 @@ class TextExecutableTests < Homebrew::TestCase attr_reader :pn def setup + super @pn = HOMEBREW_PREFIX.join("an_executable") end def teardown HOMEBREW_PREFIX.join("an_executable").unlink + super end def test_simple_shebang diff --git a/Library/Homebrew/test/os/mac/version_test.rb b/Library/Homebrew/test/os/mac/version_test.rb index f702c7097..ba4217691 100644 --- a/Library/Homebrew/test/os/mac/version_test.rb +++ b/Library/Homebrew/test/os/mac/version_test.rb @@ -4,6 +4,7 @@ require "os/mac/version" class OSMacVersionTests < Homebrew::TestCase def setup + super @v = MacOS::Version.new("10.7") end |
