Merge pull request #1888 from alyssais/tests_enforce_lifecycle
tests: enforce `super` in lifecycle hooks
This commit is contained in:
commit
ab9d8df792
@ -3,6 +3,7 @@ require "extend/ARGV"
|
||||
|
||||
class ArgvExtensionTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@argv = [].extend(HomebrewArgvExtension)
|
||||
end
|
||||
|
||||
|
@ -31,6 +31,7 @@ end
|
||||
|
||||
module SharedEnvTests
|
||||
def setup
|
||||
super
|
||||
@env = {}.extend(EnvActivation)
|
||||
end
|
||||
|
||||
|
@ -6,11 +6,13 @@ require "dev-cmd/audit"
|
||||
|
||||
class FormulaTextTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@dir = mktmpdir
|
||||
end
|
||||
|
||||
def teardown
|
||||
FileUtils.rm_rf @dir
|
||||
super
|
||||
end
|
||||
|
||||
def formula_text(name, body = nil, options = {})
|
||||
@ -58,11 +60,13 @@ end
|
||||
|
||||
class FormulaAuditorTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@dir = mktmpdir
|
||||
end
|
||||
|
||||
def teardown
|
||||
FileUtils.rm_rf @dir
|
||||
super
|
||||
end
|
||||
|
||||
def formula_auditor(name, text, options = {})
|
||||
|
@ -3,6 +3,7 @@ require "utils/bottles"
|
||||
|
||||
class BottleCollectorTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@collector = Utils::Bottles::Collector.new
|
||||
end
|
||||
|
||||
|
@ -17,6 +17,7 @@ class BottleHookTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def setup
|
||||
super
|
||||
@fi = FormulaInstaller.new FormulaDouble.new
|
||||
end
|
||||
|
||||
@ -43,5 +44,6 @@ class BottleHookTests < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
Homebrew::Hooks::Bottles.reset_hooks
|
||||
super
|
||||
end
|
||||
end
|
||||
|
@ -3,6 +3,7 @@ require "build_environment"
|
||||
|
||||
class BuildEnvironmentTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@env = BuildEnvironment.new
|
||||
end
|
||||
|
||||
|
@ -4,6 +4,7 @@ require "options"
|
||||
|
||||
class BuildOptionsTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
args = Options.create(%w[--with-foo --with-bar --without-qux])
|
||||
opts = Options.create(%w[--with-foo --with-bar --without-baz --without-qux])
|
||||
@build = BuildOptions.new(args, opts)
|
||||
|
@ -4,6 +4,7 @@ require "caveats"
|
||||
|
||||
class CaveatsTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@f = formula { url "foo-1.0" }
|
||||
@c = Caveats.new @f
|
||||
end
|
||||
|
@ -19,6 +19,7 @@ class ChecksumVerificationTests < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
@_f.clear_cache
|
||||
super
|
||||
end
|
||||
|
||||
def test_good_sha256
|
||||
|
@ -6,12 +6,14 @@ class CleanerTests < Homebrew::TestCase
|
||||
include FileUtils
|
||||
|
||||
def setup
|
||||
super
|
||||
@f = formula("cleaner_test") { url "foo-1.0" }
|
||||
@f.prefix.mkpath
|
||||
end
|
||||
|
||||
def teardown
|
||||
@f.rack.rmtree if @f.rack.exist?
|
||||
super
|
||||
end
|
||||
|
||||
def test_clean_file
|
||||
|
@ -14,6 +14,7 @@ end
|
||||
|
||||
class CleanupTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@ds_store = Pathname.new "#{HOMEBREW_PREFIX}/Library/.DS_Store"
|
||||
FileUtils.touch @ds_store
|
||||
end
|
||||
@ -22,6 +23,7 @@ class CleanupTests < Homebrew::TestCase
|
||||
FileUtils.rm_f @ds_store
|
||||
ARGV.delete "--dry-run"
|
||||
ARGV.delete "--prune=all"
|
||||
super
|
||||
end
|
||||
|
||||
def test_cleanup
|
||||
|
@ -13,6 +13,7 @@ end
|
||||
|
||||
class CommandsTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@cmds = [
|
||||
# internal commands
|
||||
HOMEBREW_LIBRARY_PATH/"cmd/rbcmd.rb",
|
||||
@ -28,6 +29,7 @@ class CommandsTests < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
@cmds.each(&:unlink)
|
||||
super
|
||||
end
|
||||
|
||||
def test_internal_commands
|
||||
|
@ -31,6 +31,7 @@ class CompilerSelectorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def setup
|
||||
super
|
||||
@f = Double.new
|
||||
@cc = :clang
|
||||
@versions = CompilerVersions.new
|
||||
|
@ -5,6 +5,7 @@ require "requirements"
|
||||
|
||||
class DependenciesTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@deps = Dependencies.new
|
||||
end
|
||||
|
||||
@ -89,6 +90,7 @@ end
|
||||
|
||||
class RequirementsTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@reqs = Requirements.new
|
||||
end
|
||||
|
||||
|
@ -11,11 +11,13 @@ class DependencyCollectorTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def setup
|
||||
super
|
||||
@d = DependencyCollector.new
|
||||
end
|
||||
|
||||
def teardown
|
||||
DependencyCollector.clear_cache
|
||||
super
|
||||
end
|
||||
|
||||
def test_dependency_creation
|
||||
|
@ -9,6 +9,7 @@ class DependencyExpansionTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def setup
|
||||
super
|
||||
@foo = build_dep(:foo)
|
||||
@bar = build_dep(:bar)
|
||||
@baz = build_dep(:baz)
|
||||
|
@ -3,6 +3,7 @@ require "dependency"
|
||||
|
||||
class DependableTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@tags = ["foo", "bar", :build]
|
||||
@dep = Struct.new(:tags).new(@tags).extend(Dependable)
|
||||
end
|
||||
|
@ -3,6 +3,8 @@ require "descriptions"
|
||||
|
||||
class DescriptionsTest < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
|
||||
@descriptions_hash = {}
|
||||
@descriptions = Descriptions.new(@descriptions_hash)
|
||||
|
||||
@ -12,6 +14,7 @@ class DescriptionsTest < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
$stdout = @old_stdout
|
||||
super
|
||||
end
|
||||
|
||||
def test_single_core_formula
|
||||
|
@ -5,12 +5,14 @@ require "diagnostic"
|
||||
|
||||
class DiagnosticChecksTest < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@env = ENV.to_hash
|
||||
@checks = Homebrew::Diagnostic::Checks.new
|
||||
end
|
||||
|
||||
def teardown
|
||||
ENV.replace(@env)
|
||||
super
|
||||
end
|
||||
|
||||
def test_inject_file_list
|
||||
|
@ -15,6 +15,7 @@ class AbstractDownloadStrategyTests < Homebrew::TestCase
|
||||
include FileUtils
|
||||
|
||||
def setup
|
||||
super
|
||||
@name = "foo"
|
||||
@resource = ResourceDouble.new
|
||||
@strategy = AbstractDownloadStrategy.new(@name, @resource)
|
||||
@ -63,6 +64,7 @@ end
|
||||
|
||||
class GitHubPrivateRepositoryDownloadStrategyTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
resource = ResourceDouble.new("https://github.com/owner/repo/archive/1.1.5.tar.gz")
|
||||
ENV["HOMEBREW_GITHUB_API_TOKEN"] = "token"
|
||||
GitHub.stubs(:repository).returns {}
|
||||
@ -87,6 +89,7 @@ end
|
||||
|
||||
class GitHubPrivateRepositoryReleaseDownloadStrategyTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
resource = ResourceDouble.new("https://github.com/owner/repo/releases/download/tag/foo_v0.1.0_darwin_amd64.tar.gz")
|
||||
ENV["HOMEBREW_GITHUB_API_TOKEN"] = "token"
|
||||
GitHub.stubs(:repository).returns {}
|
||||
@ -138,6 +141,7 @@ class GitDownloadStrategyTests < Homebrew::TestCase
|
||||
include FileUtils
|
||||
|
||||
def setup
|
||||
super
|
||||
resource = ResourceDouble.new("https://github.com/homebrew/foo")
|
||||
@commit_id = 1
|
||||
@strategy = GitDownloadStrategy.new("baz", resource)
|
||||
@ -147,6 +151,7 @@ class GitDownloadStrategyTests < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
rmtree @cached_location
|
||||
super
|
||||
end
|
||||
|
||||
def git_commit_all
|
||||
@ -236,6 +241,7 @@ end
|
||||
|
||||
class DownloadStrategyDetectorTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@d = DownloadStrategyDetector.new
|
||||
end
|
||||
|
||||
|
@ -3,6 +3,7 @@ require "formula_lock"
|
||||
|
||||
class FormulaLockTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@lock = FormulaLock.new("foo")
|
||||
@lock.lock
|
||||
end
|
||||
@ -10,6 +11,7 @@ class FormulaLockTests < Homebrew::TestCase
|
||||
def teardown
|
||||
@lock.unlock
|
||||
HOMEBREW_LOCK_DIR.children.each(&:unlink)
|
||||
super
|
||||
end
|
||||
|
||||
def test_locking_file_with_existing_lock_raises_error
|
||||
|
@ -21,6 +21,7 @@ class FormulaPinTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def setup
|
||||
super
|
||||
@f = FormulaDouble.new
|
||||
@pin = FormulaPin.new(@f)
|
||||
@f.rack.mkpath
|
||||
@ -50,5 +51,6 @@ class FormulaPinTests < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
@f.rack.rmtree
|
||||
super
|
||||
end
|
||||
end
|
||||
|
@ -874,6 +874,8 @@ class AliasChangeTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def setup
|
||||
super
|
||||
|
||||
alias_name = "bar"
|
||||
@alias_path = "#{CoreTap.instance.alias_dir}/#{alias_name}"
|
||||
|
||||
@ -942,6 +944,8 @@ class OutdatedVersionsTests < Homebrew::TestCase
|
||||
attr_reader :f, :old_formula, :new_formula
|
||||
|
||||
def setup
|
||||
super
|
||||
|
||||
@f = formula do
|
||||
url "foo"
|
||||
version "1.20"
|
||||
@ -960,6 +964,7 @@ class OutdatedVersionsTests < Homebrew::TestCase
|
||||
def teardown
|
||||
formulae = [@f, @old_formula, @new_formula]
|
||||
formulae.map(&:rack).select(&:exist?).each(&:rmtree)
|
||||
super
|
||||
end
|
||||
|
||||
def alias_path
|
||||
|
@ -16,6 +16,7 @@ end
|
||||
|
||||
class FormularyFactoryTest < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@name = "testball_bottle"
|
||||
@path = CoreTap.new.formula_dir/"#{@name}.rb"
|
||||
@bottle_dir = Pathname.new("#{TEST_FIXTURE_DIR}/bottles")
|
||||
@ -41,6 +42,7 @@ class FormularyFactoryTest < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
@path.unlink
|
||||
super
|
||||
end
|
||||
|
||||
def test_factory
|
||||
@ -129,6 +131,7 @@ end
|
||||
|
||||
class FormularyTapFactoryTest < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@name = "foo"
|
||||
@tap = Tap.new "homebrew", "foo"
|
||||
@path = @tap.path/"#{@name}.rb"
|
||||
@ -142,6 +145,7 @@ class FormularyTapFactoryTest < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
@tap.path.rmtree
|
||||
super
|
||||
end
|
||||
|
||||
def test_factory_tap_formula
|
||||
@ -174,6 +178,7 @@ end
|
||||
|
||||
class FormularyTapPriorityTest < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@name = "foo"
|
||||
@core_path = CoreTap.new.formula_dir/"#{@name}.rb"
|
||||
@tap = Tap.new "homebrew", "foo"
|
||||
@ -190,6 +195,7 @@ class FormularyTapPriorityTest < Homebrew::TestCase
|
||||
def teardown
|
||||
@core_path.unlink
|
||||
@tap.path.rmtree
|
||||
super
|
||||
end
|
||||
|
||||
def test_find_with_priority_core_formula
|
||||
|
@ -4,6 +4,7 @@ require "fileutils"
|
||||
|
||||
class GPG2RequirementTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@dir = Pathname.new(mktmpdir)
|
||||
(@dir/"bin/gpg").write <<-EOS.undent
|
||||
#!/bin/bash
|
||||
@ -14,6 +15,7 @@ class GPG2RequirementTests < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
FileUtils.rm_rf @dir
|
||||
super
|
||||
end
|
||||
|
||||
def test_satisfied
|
||||
|
@ -3,6 +3,7 @@ require "gpg"
|
||||
|
||||
class GpgTest < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
skip "GPG Unavailable" unless Gpg.available?
|
||||
@dir = Pathname.new(mktmpdir)
|
||||
end
|
||||
|
@ -20,6 +20,8 @@ class LinkTestCase < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def setup
|
||||
super
|
||||
|
||||
@keg = setup_test_keg("foo", "1.0")
|
||||
@dst = HOMEBREW_PREFIX.join("bin", "helloworld")
|
||||
@nonexistent = Pathname.new("/some/nonexistent/path")
|
||||
@ -43,6 +45,8 @@ class LinkTestCase < Homebrew::TestCase
|
||||
|
||||
rmtree HOMEBREW_PREFIX/"bin"
|
||||
rmtree HOMEBREW_PREFIX/"lib"
|
||||
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -4,6 +4,7 @@ require "resource"
|
||||
|
||||
class LanguagePythonTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@dir = Pathname.new(mktmpdir)
|
||||
resource = stub("resource", stage: true)
|
||||
formula_bin = @dir/"formula_bin"
|
||||
@ -16,6 +17,7 @@ class LanguagePythonTests < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
FileUtils.rm_rf @dir
|
||||
super
|
||||
end
|
||||
|
||||
def test_virtualenv_creation
|
||||
|
@ -10,6 +10,7 @@ end
|
||||
|
||||
class MigratorErrorsTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@new_f = Testball.new("newname")
|
||||
@new_f.oldname = "oldname"
|
||||
@old_f = Testball.new("oldname")
|
||||
@ -40,6 +41,8 @@ class MigratorTests < Homebrew::TestCase
|
||||
include FileUtils
|
||||
|
||||
def setup
|
||||
super
|
||||
|
||||
@new_f = Testball.new("newname")
|
||||
@new_f.oldname = "oldname"
|
||||
|
||||
@ -93,6 +96,8 @@ class MigratorTests < Homebrew::TestCase
|
||||
@new_f.unpin
|
||||
|
||||
HOMEBREW_LOCK_DIR.children.each(&:unlink)
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
def test_move_cellar
|
||||
|
@ -15,6 +15,7 @@ end
|
||||
|
||||
class OptionTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@option = Option.new("foo")
|
||||
end
|
||||
|
||||
@ -43,6 +44,7 @@ end
|
||||
|
||||
class DeprecatedOptionTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@deprecated_option = DeprecatedOption.new("foo", "bar")
|
||||
end
|
||||
|
||||
@ -68,6 +70,7 @@ end
|
||||
|
||||
class OptionsTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@options = Options.new
|
||||
end
|
||||
|
||||
|
@ -3,6 +3,7 @@ require "utils/bottles"
|
||||
|
||||
class OSMacBottleCollectorTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@collector = Utils::Bottles::Collector.new
|
||||
end
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -4,6 +4,7 @@ require "os/mac/version"
|
||||
|
||||
class OSMacVersionTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@v = MacOS::Version.new("10.7")
|
||||
end
|
||||
|
||||
|
@ -111,6 +111,7 @@ end
|
||||
|
||||
class ExternalPatchTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@p = ExternalPatch.new(:p1) { url "file:///my.patch" }
|
||||
end
|
||||
|
||||
|
@ -23,6 +23,7 @@ class PatchingTests < Homebrew::TestCase
|
||||
def teardown
|
||||
@_f.clear_cache
|
||||
@_f.patchlist.each { |p| p.clear_cache if p.external? }
|
||||
super
|
||||
end
|
||||
|
||||
def assert_patched(formula)
|
||||
|
@ -7,6 +7,7 @@ module PathnameTestExtension
|
||||
include FileUtils
|
||||
|
||||
def setup
|
||||
super
|
||||
@src = Pathname.new(mktmpdir)
|
||||
@dst = Pathname.new(mktmpdir)
|
||||
@file = @src/"foo"
|
||||
@ -16,6 +17,7 @@ module PathnameTestExtension
|
||||
def teardown
|
||||
rmtree(@src)
|
||||
rmtree(@dst)
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -3,6 +3,7 @@ require "resource"
|
||||
|
||||
class ResourceTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@resource = Resource.new("test")
|
||||
end
|
||||
|
||||
|
@ -3,6 +3,7 @@ require "sandbox"
|
||||
|
||||
class SandboxTest < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
skip "sandbox not implemented" unless Sandbox.available?
|
||||
@sandbox = Sandbox.new
|
||||
@dir = Pathname.new(mktmpdir)
|
||||
@ -11,6 +12,7 @@ class SandboxTest < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
@dir.rmtree
|
||||
super
|
||||
end
|
||||
|
||||
def test_formula?
|
||||
|
@ -3,6 +3,7 @@ require "software_spec"
|
||||
|
||||
class SoftwareSpecTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@spec = SoftwareSpec.new
|
||||
end
|
||||
|
||||
@ -136,6 +137,7 @@ end
|
||||
|
||||
class HeadSoftwareSpecTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@spec = HeadSoftwareSpec.new
|
||||
end
|
||||
|
||||
@ -150,6 +152,7 @@ end
|
||||
|
||||
class BottleSpecificationTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@spec = BottleSpecification.new
|
||||
end
|
||||
|
||||
|
@ -4,6 +4,7 @@ require "cxxstdlib"
|
||||
|
||||
class CxxStdlibTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@clang = CxxStdlib.create(:libstdcxx, :clang)
|
||||
@gcc = CxxStdlib.create(:libstdcxx, :gcc)
|
||||
@gcc40 = CxxStdlib.create(:libstdcxx, :gcc_4_0)
|
||||
|
@ -6,6 +6,7 @@ require "test/support/helper/test_case"
|
||||
|
||||
class IntegrationCommandTestCase < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@cmd_id_index = 0 # Assign unique IDs to invocations of `cmd_output`.
|
||||
(HOMEBREW_PREFIX/"bin").mkpath
|
||||
FileUtils.touch HOMEBREW_PREFIX/"bin/brew"
|
||||
@ -38,6 +39,7 @@ class IntegrationCommandTestCase < Homebrew::TestCase
|
||||
coretap.path/"formula_renames.json",
|
||||
].flatten
|
||||
FileUtils.rm_rf paths_to_delete
|
||||
super
|
||||
end
|
||||
|
||||
def needs_test_cmd_taps
|
||||
|
22
Library/Homebrew/test/support/helper/lifecycle_enforcer.rb
Normal file
22
Library/Homebrew/test/support/helper/lifecycle_enforcer.rb
Normal file
@ -0,0 +1,22 @@
|
||||
module Test
|
||||
module Helper
|
||||
module LifecycleEnforcer
|
||||
def setup
|
||||
@__setup_called = true
|
||||
super
|
||||
end
|
||||
|
||||
def teardown
|
||||
@__teardown_called = true
|
||||
super
|
||||
end
|
||||
|
||||
def after_teardown
|
||||
assert @__setup_called, "Expected setup to call `super` but didn't"
|
||||
assert @__teardown_called, "Expected teardown to call `super` but didn't"
|
||||
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -2,10 +2,12 @@ module Homebrew
|
||||
class TestCase < ::Minitest::Test
|
||||
require "test/support/helper/env"
|
||||
require "test/support/helper/fs_leak_logger"
|
||||
require "test/support/helper/lifecycle_enforcer"
|
||||
require "test/support/helper/shutup"
|
||||
require "test/support/helper/version_assertions"
|
||||
include Test::Helper::Env
|
||||
include Test::Helper::FSLeakLogger
|
||||
include Test::Helper::LifecycleEnforcer
|
||||
include Test::Helper::Shutup
|
||||
include Test::Helper::VersionAssertions
|
||||
|
||||
|
@ -4,6 +4,8 @@ require "formula"
|
||||
|
||||
class TabTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
|
||||
@used = Options.create(%w[--with-foo --without-bar])
|
||||
@unused = Options.create(%w[--with-baz --without-qux])
|
||||
|
||||
@ -260,6 +262,7 @@ end
|
||||
|
||||
class TabLoadingTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@f = formula { url "foo-1.0" }
|
||||
@f.prefix.mkpath
|
||||
@path = @f.prefix.join(Tab::FILENAME)
|
||||
@ -268,6 +271,7 @@ class TabLoadingTests < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
@f.rack.rmtree
|
||||
super
|
||||
end
|
||||
|
||||
def test_for_keg
|
||||
|
@ -34,6 +34,7 @@ class TapTest < Homebrew::TestCase
|
||||
include FileUtils
|
||||
|
||||
def setup
|
||||
super
|
||||
@path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
|
||||
@path.mkpath
|
||||
@tap = Tap.new("Homebrew", "foo")
|
||||
@ -86,6 +87,7 @@ class TapTest < Homebrew::TestCase
|
||||
|
||||
def teardown
|
||||
@path.rmtree
|
||||
super
|
||||
end
|
||||
|
||||
def test_fetch
|
||||
@ -285,6 +287,7 @@ class CoreTapTest < Homebrew::TestCase
|
||||
include FileUtils
|
||||
|
||||
def setup
|
||||
super
|
||||
@repo = CoreTap.new
|
||||
end
|
||||
|
||||
|
@ -3,6 +3,8 @@ require "cmd/uninstall"
|
||||
|
||||
class UninstallTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
|
||||
@dependency = formula("dependency") { url "f-1" }
|
||||
@dependent = formula("dependent") do
|
||||
url "f-1"
|
||||
@ -32,6 +34,7 @@ class UninstallTests < Homebrew::TestCase
|
||||
f.installed_kegs.each(&:remove_opt_record)
|
||||
f.rack.rmtree
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def handle_unsatisfied_dependents
|
||||
|
@ -24,6 +24,7 @@ class ReportTests < Homebrew::TestCase
|
||||
end
|
||||
|
||||
def setup
|
||||
super
|
||||
@tap = CoreTap.new
|
||||
@reporter = ReporterMock.new(@tap)
|
||||
@hub = ReporterHub.new
|
||||
|
@ -5,6 +5,7 @@ require "utils/shell"
|
||||
|
||||
class UtilTests < Homebrew::TestCase
|
||||
def setup
|
||||
super
|
||||
@dir = Pathname.new(mktmpdir)
|
||||
@env = ENV.to_hash
|
||||
end
|
||||
@ -12,6 +13,7 @@ class UtilTests < Homebrew::TestCase
|
||||
def teardown
|
||||
@dir.rmtree
|
||||
ENV.replace @env
|
||||
super
|
||||
end
|
||||
|
||||
def test_ofail
|
||||
|
Loading…
x
Reference in New Issue
Block a user