Move all remaining fixtures to test/support/fixtures.

This commit is contained in:
Markus Reiter 2016-10-24 22:53:25 +02:00
parent 4efdbbde06
commit 4db1317f38
143 changed files with 166 additions and 108 deletions

View File

@ -8,15 +8,15 @@ end
# add Homebrew to load path # add Homebrew to load path
$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew")) $LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew"))
$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew/test/lib")) $LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew/test/support/lib"))
require "global" require "global"
# add Homebrew-Cask to load path # add Homebrew-Cask to load path
$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.join("cask", "lib").to_s) $LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.join("cask", "lib").to_s)
require "test/helper/env" require "test/support/helper/env"
require "test/helper/shutup" require "test/support/helper/shutup"
Pathname.glob(HOMEBREW_LIBRARY_PATH.join("cask", "spec", "support", "*.rb")).each(&method(:require)) Pathname.glob(HOMEBREW_LIBRARY_PATH.join("cask", "spec", "support", "*.rb")).each(&method(:require))

View File

@ -6,15 +6,15 @@ require "simplecov" if ENV["HOMEBREW_TESTS_COVERAGE"]
# add Homebrew to load path # add Homebrew to load path
$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew")) $LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew"))
$LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew/test/lib")) $LOAD_PATH.unshift(File.expand_path("#{ENV["HOMEBREW_REPOSITORY"]}/Library/Homebrew/test/support/lib"))
require "global" require "global"
# add Homebrew-Cask to load path # add Homebrew-Cask to load path
$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.join("cask", "lib").to_s) $LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.join("cask", "lib").to_s)
require "test/helper/env" require "test/support/helper/env"
require "test/helper/shutup" require "test/support/helper/shutup"
include Test::Helper::Env include Test::Helper::Env
include Test::Helper::Shutup include Test::Helper::Shutup

View File

Before

Width:  |  Height:  |  Size: 43 B

After

Width:  |  Height:  |  Size: 43 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 288 B

After

Width:  |  Height:  |  Size: 288 B

View File

Before

Width:  |  Height:  |  Size: 82 B

After

Width:  |  Height:  |  Size: 82 B

View File

Before

Width:  |  Height:  |  Size: 264 B

After

Width:  |  Height:  |  Size: 264 B

View File

@ -1,7 +1,7 @@
class Testball < Formula class Testball < Formula
def initialize(name = "testball", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil) def initialize(name = "testball", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil)
self.class.instance_eval do self.class.instance_eval do
stable.url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz"
stable.sha256 TESTBALL_SHA256 stable.sha256 TESTBALL_SHA256
end end
super super

View File

@ -1,11 +1,11 @@
class TestballBottle < Formula class TestballBottle < Formula
def initialize(name = "testball_bottle", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil) def initialize(name = "testball_bottle", path = Pathname.new(__FILE__).expand_path, spec = :stable, alias_path: nil)
self.class.instance_eval do self.class.instance_eval do
stable.url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" stable.url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz"
stable.sha256 TESTBALL_SHA256 stable.sha256 TESTBALL_SHA256
stable.bottle do stable.bottle do
cellar :any_skip_relocation cellar :any_skip_relocation
root_url "file://#{File.expand_path("..", __FILE__)}/bottles" root_url "file://#{TEST_FIXTURE_DIR}/bottles"
sha256 "9abc8ce779067e26556002c4ca6b9427b9874d25f0cafa7028e05b5c5c410cb4" => Utils::Bottles.tag sha256 "9abc8ce779067e26556002c4ca6b9427b9874d25f0cafa7028e05b5c5c410cb4" => Utils::Bottles.tag
end end
cxxstdlib_check :skip cxxstdlib_check :skip

View File

@ -1,7 +1,7 @@
class Testbottest < Formula class Testbottest < Formula
desc "Minimal C program and Makefile used for testing Homebrew." desc "Minimal C program and Makefile used for testing Homebrew."
homepage "https://github.com/Homebrew/brew" homepage "https://github.com/Homebrew/brew"
url "file://#{File.expand_path("..", __FILE__)}/tarballs/testbottest-0.1.tbz" url "file://#{TEST_FIXTURE_DIR}/tarballs/testbottest-0.1.tbz"
sha256 "78b54d8f31585c9773bed12b4aa4ab2ce458ebd044b9406cb24d40aa5107f082" sha256 "78b54d8f31585c9773bed12b4aa4ab2ce458ebd044b9406cb24d40aa5107f082"
def install def install

View File

@ -1,5 +1,4 @@
require "bundler" require "bundler"
require "testing_env"
require "fileutils" require "fileutils"
require "pathname" require "pathname"
require "formula" require "formula"
@ -21,6 +20,7 @@ class IntegrationCommandTestCase < Homebrew::TestCase
HOMEBREW_LOCK_DIR.children, HOMEBREW_LOCK_DIR.children,
HOMEBREW_LOGS.children, HOMEBREW_LOGS.children,
HOMEBREW_TEMP.children, HOMEBREW_TEMP.children,
HOMEBREW_PREFIX/".git",
HOMEBREW_PREFIX/"bin", HOMEBREW_PREFIX/"bin",
HOMEBREW_PREFIX/"share", HOMEBREW_PREFIX/"share",
HOMEBREW_PREFIX/"opt", HOMEBREW_PREFIX/"opt",
@ -59,7 +59,7 @@ class IntegrationCommandTestCase < Homebrew::TestCase
env = args.last.is_a?(Hash) ? args.pop : {} env = args.last.is_a?(Hash) ? args.pop : {}
cmd_args = %W[ cmd_args = %W[
-W0 -W0
-I#{HOMEBREW_LIBRARY_PATH}/test/lib -I#{HOMEBREW_LIBRARY_PATH}/test/support/lib
-rconfig -rconfig
] ]
if ENV["HOMEBREW_TESTS_COVERAGE"] if ENV["HOMEBREW_TESTS_COVERAGE"]
@ -125,7 +125,7 @@ class IntegrationCommandTestCase < Homebrew::TestCase
content = <<-EOS.undent content = <<-EOS.undent
desc "Some test" desc "Some test"
homepage "https://example.com/#{name}" homepage "https://example.com/#{name}"
url "file://#{File.expand_path("../..", __FILE__)}/tarballs/testball-0.1.tbz" url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz"
sha256 "#{TESTBALL_SHA256}" sha256 "#{TESTBALL_SHA256}"
option "with-foo", "Build with foo" option "with-foo", "Build with foo"
@ -195,6 +195,6 @@ class IntegrationCommandTestCase < Homebrew::TestCase
end end
def testball def testball
"#{File.expand_path("../..", __FILE__)}/testball.rb" "#{TEST_FIXTURE_DIR}/testball.rb"
end end
end end

View File

@ -14,7 +14,7 @@ TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") do |k|
end end
# Paths pointing into the Homebrew code base that persist across test runs # Paths pointing into the Homebrew code base that persist across test runs
HOMEBREW_LIBRARY_PATH = Pathname.new(File.expand_path("../../..", __FILE__)) HOMEBREW_LIBRARY_PATH = Pathname.new(File.expand_path("../../../..", __FILE__))
HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY_PATH.parent+"Homebrew/shims" HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY_PATH.parent+"Homebrew/shims"
HOMEBREW_LOAD_PATH = [File.expand_path("..", __FILE__), HOMEBREW_LIBRARY_PATH].join(":") HOMEBREW_LOAD_PATH = [File.expand_path("..", __FILE__), HOMEBREW_LIBRARY_PATH].join(":")
@ -31,7 +31,7 @@ HOMEBREW_CELLAR = HOMEBREW_PREFIX.parent+"cellar"
HOMEBREW_LOGS = HOMEBREW_PREFIX.parent+"logs" HOMEBREW_LOGS = HOMEBREW_PREFIX.parent+"logs"
HOMEBREW_TEMP = HOMEBREW_PREFIX.parent+"temp" HOMEBREW_TEMP = HOMEBREW_PREFIX.parent+"temp"
TEST_FIXTURE_DIR = HOMEBREW_LIBRARY_PATH.join("test", "fixtures") TEST_FIXTURE_DIR = HOMEBREW_LIBRARY_PATH.join("test", "support", "fixtures")
TESTBALL_SHA1 = "be478fd8a80fe7f29196d6400326ac91dad68c37".freeze TESTBALL_SHA1 = "be478fd8a80fe7f29196d6400326ac91dad68c37".freeze
TESTBALL_SHA256 = "91e3f7930c98d7ccfb288e115ed52d06b0e5bc16fec7dce8bdda86530027067b".freeze TESTBALL_SHA256 = "91e3f7930c98d7ccfb288e115ed52d06b0e5bc16fec7dce8bdda86530027067b".freeze

View File

@ -1,6 +1,7 @@
require "testing_env" require "testing_env"
require "extend/ENV" require "extend/ENV"
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestEnv < IntegrationCommandTestCase class IntegrationCommandTestEnv < IntegrationCommandTestCase
def test_env def test_env

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestAnalytics < IntegrationCommandTestCase class IntegrationCommandTestAnalytics < IntegrationCommandTestCase
def test_analytics def test_analytics

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestBottle < IntegrationCommandTestCase class IntegrationCommandTestBottle < IntegrationCommandTestCase
def test_bottle def test_bottle

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestBundle < IntegrationCommandTestCase class IntegrationCommandTestBundle < IntegrationCommandTestCase
def test_bundle def test_bundle

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestCacheFormula < IntegrationCommandTestCase class IntegrationCommandTestCacheFormula < IntegrationCommandTestCase
def test_cache_formula def test_cache_formula

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestCache < IntegrationCommandTestCase class IntegrationCommandTestCache < IntegrationCommandTestCase
def test_cache def test_cache

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestCask < IntegrationCommandTestCase class IntegrationCommandTestCask < IntegrationCommandTestCase
def test_cask def test_cask

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestCat < IntegrationCommandTestCase class IntegrationCommandTestCat < IntegrationCommandTestCase
def test_cat def test_cat

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestCellarFormula < IntegrationCommandTestCase class IntegrationCommandTestCellarFormula < IntegrationCommandTestCase
def test_cellar_formula def test_cellar_formula

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestCellar < IntegrationCommandTestCase class IntegrationCommandTestCellar < IntegrationCommandTestCase
def test_cellar def test_cellar

View File

@ -12,7 +12,7 @@ class ChecksumVerificationTests < Homebrew::TestCase
def formula(&block) def formula(&block)
super do super do
url "file://#{TEST_DIRECTORY}/tarballs/testball-0.1.tbz" url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz"
instance_eval(&block) instance_eval(&block)
end end
end end

View File

@ -17,8 +17,8 @@ class CleanerTests < Homebrew::TestCase
def test_clean_file def test_clean_file
@f.bin.mkpath @f.bin.mkpath
@f.lib.mkpath @f.lib.mkpath
cp "#{TEST_DIRECTORY}/mach/a.out", @f.bin cp "#{TEST_FIXTURE_DIR}/mach/a.out", @f.bin
cp Dir["#{TEST_DIRECTORY}/mach/*.dylib"], @f.lib cp Dir["#{TEST_FIXTURE_DIR}/mach/*.dylib"], @f.lib
Cleaner.new(@f).clean Cleaner.new(@f).clean

View File

@ -1,9 +1,10 @@
require "testing_env" require "testing_env"
require "testball" require "test/support/fixtures/testball"
require "cleanup" require "cleanup"
require "fileutils" require "fileutils"
require "pathname" require "pathname"
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestCleanup < IntegrationCommandTestCase class IntegrationCommandTestCleanup < IntegrationCommandTestCase
def test_cleanup def test_cleanup

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestCommand < IntegrationCommandTestCase class IntegrationCommandTestCommand < IntegrationCommandTestCase
def test_command def test_command

View File

@ -2,7 +2,8 @@ require "testing_env"
require "cmd/command" require "cmd/command"
require "cmd/commands" require "cmd/commands"
require "fileutils" require "fileutils"
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestCommands < IntegrationCommandTestCase class IntegrationCommandTestCommands < IntegrationCommandTestCase
def test_commands def test_commands

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestConfig < IntegrationCommandTestCase class IntegrationCommandTestConfig < IntegrationCommandTestCase
def test_config def test_config

View File

@ -1,8 +1,9 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestCreate < IntegrationCommandTestCase class IntegrationCommandTestCreate < IntegrationCommandTestCase
def test_create def test_create
url = "file://#{TEST_DIRECTORY}/tarballs/testball-0.1.tbz" url = "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz"
cmd("create", url, "HOMEBREW_EDITOR" => "/bin/cat") cmd("create", url, "HOMEBREW_EDITOR" => "/bin/cat")
formula_file = CoreTap.new.formula_dir/"testball.rb" formula_file = CoreTap.new.formula_dir/"testball.rb"

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestCustomCommand < IntegrationCommandTestCase class IntegrationCommandTestCustomCommand < IntegrationCommandTestCase
def test_custom_command def test_custom_command

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestDeps < IntegrationCommandTestCase class IntegrationCommandTestDeps < IntegrationCommandTestCase
def test_deps def test_deps

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestDesc < IntegrationCommandTestCase class IntegrationCommandTestDesc < IntegrationCommandTestCase
def test_desc def test_desc

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestDoctor < IntegrationCommandTestCase class IntegrationCommandTestDoctor < IntegrationCommandTestCase
def test_doctor def test_doctor

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestEdit < IntegrationCommandTestCase class IntegrationCommandTestEdit < IntegrationCommandTestCase
def test_edit def test_edit

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestFetch < IntegrationCommandTestCase class IntegrationCommandTestFetch < IntegrationCommandTestCase
def test_fetch def test_fetch

View File

@ -3,8 +3,8 @@ require "formula"
require "formula_installer" require "formula_installer"
require "keg" require "keg"
require "tab" require "tab"
require "testball" require "test/support/fixtures/testball"
require "testball_bottle" require "test/support/fixtures/testball_bottle"
class InstallBottleTests < Homebrew::TestCase class InstallBottleTests < Homebrew::TestCase
def temporary_bottle_install(formula) def temporary_bottle_install(formula)

View File

@ -3,8 +3,8 @@ require "formula"
require "formula_installer" require "formula_installer"
require "keg" require "keg"
require "tab" require "tab"
require "testball" require "test/support/fixtures/testball"
require "testball_bottle" require "test/support/fixtures/testball_bottle"
class InstallTests < Homebrew::TestCase class InstallTests < Homebrew::TestCase
def temporary_install(formula) def temporary_install(formula)

View File

@ -1,5 +1,5 @@
require "testing_env" require "testing_env"
require "testball" require "test/support/fixtures/testball"
require "formula" require "formula"
class FormulaTests < Homebrew::TestCase class FormulaTests < Homebrew::TestCase

View File

@ -18,11 +18,11 @@ class FormularyFactoryTest < Homebrew::TestCase
def setup def setup
@name = "testball_bottle" @name = "testball_bottle"
@path = CoreTap.new.formula_dir/"#{@name}.rb" @path = CoreTap.new.formula_dir/"#{@name}.rb"
@bottle_dir = Pathname.new("#{TEST_DIRECTORY}/bottles") @bottle_dir = Pathname.new("#{TEST_FIXTURE_DIR}/bottles")
@bottle = @bottle_dir/"testball_bottle-0.1.#{Utils::Bottles.tag}.bottle.tar.gz" @bottle = @bottle_dir/"testball_bottle-0.1.#{Utils::Bottles.tag}.bottle.tar.gz"
@path.write <<-EOS.undent @path.write <<-EOS.undent
class #{Formulary.class_s(@name)} < Formula class #{Formulary.class_s(@name)} < Formula
url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" url "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz"
sha256 TESTBALL_SHA256 sha256 TESTBALL_SHA256
bottle do bottle do

View File

@ -1,4 +1,5 @@
require "helper/integration_command_test_case" require "testing_env"
require "test/support/helper/integration_command_test_case"
class IntegrationCommandTestHelp < IntegrationCommandTestCase class IntegrationCommandTestHelp < IntegrationCommandTestCase
def test_help def test_help

Some files were not shown because too many files have changed in this diff Show More