Merge pull request #2746 from MikeMcQuaid/cleanup-tests

tests: cleanup tests.
This commit is contained in:
Mike McQuaid 2017-06-08 16:16:55 +03:00 committed by GitHub
commit 2269518768
15 changed files with 9 additions and 229 deletions

View File

@ -12,10 +12,8 @@
#: If `--no-compat` is passed, do not load the compatibility layer when
#: running tests.
#:
#: If `--online` is passed, include tests that use the GitHub API.
#:
#: If `--official-cmd-taps` is passed, include tests that use any of the
#: taps for official external commands.
#: If `--online` is passed, include tests that use the GitHub API and tests
#: that use any of the taps for official external commands.
require "fileutils"
require "tap"
@ -40,10 +38,6 @@ module Homebrew
ENV["HOMEBREW_NO_GITHUB_API"] = "1"
end
if ARGV.include? "--official-cmd-taps"
ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"] = "1"
end
if ARGV.include? "--coverage"
ENV["HOMEBREW_TESTS_COVERAGE"] = "1"
FileUtils.rm_f "test/coverage/.resultset.json"

View File

@ -10,19 +10,6 @@ describe Hbc::Artifact::Suite, :cask do
InstallHelper.install_without_artifacts(cask)
end
it "moves the suite to the proper directory" do
skip("flaky test") # FIXME
shutup do
install_phase.call
end
expect(target_path).to be_a_directory
expect(target_path).to be_a_symlink
expect(target_path.readlink).to exist
expect(source_path).not_to exist
end
it "creates a suite containing the expected app" do
shutup do
install_phase.call

View File

@ -37,45 +37,6 @@ describe Hbc::Installer, :cask do
expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with cab-based Casks" do
skip("cabextract not installed") if which("cabextract").nil?
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-cab.rb")
allow(asset).to receive(:depends_on).and_return(empty_depends_on_stub)
shutup do
Hbc::Installer.new(asset).install
end
expect(Hbc.caskroom.join("container-cab", asset.version)).to be_a_directory
expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with Adobe AIR-based Casks" do
skip("Adobe AIR not installed") unless Hbc::Container::Air.installer_exist?
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-air.rb")
shutup do
Hbc::Installer.new(asset).install
end
expect(Hbc.caskroom.join("container-air", asset.version)).to be_a_directory
expect(Hbc.appdir.join("container.app")).to be_a_directory
end
it "works with 7z-based Casks" do
skip("unar not installed") if which("unar").nil?
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-7z.rb")
allow(asset).to receive(:depends_on).and_return(empty_depends_on_stub)
shutup do
Hbc::Installer.new(asset).install
end
expect(Hbc.caskroom.join("container-7z", asset.version)).to be_a_directory
expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with xar-based Casks" do
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-xar.rb")
@ -87,32 +48,6 @@ describe Hbc::Installer, :cask do
expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with Stuffit-based Casks" do
skip("unar not installed") if which("unar").nil?
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-sit.rb")
allow(asset).to receive(:depends_on).and_return(empty_depends_on_stub)
shutup do
Hbc::Installer.new(asset).install
end
expect(Hbc.caskroom.join("container-sit", asset.version)).to be_a_directory
expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with RAR-based Casks" do
skip("unar not installed") if which("unar").nil?
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-rar.rb")
allow(asset).to receive(:depends_on).and_return(empty_depends_on_stub)
shutup do
Hbc::Installer.new(asset).install
end
expect(Hbc.caskroom.join("container-rar", asset.version)).to be_a_directory
expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with pure bzip2-based Casks" do
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-bzip2.rb")
@ -135,45 +70,6 @@ describe Hbc::Installer, :cask do
expect(Hbc.appdir.join("container")).to be_a_file
end
it "works with pure xz-based Casks" do
skip("unxz not installed") if which("unxz").nil?
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-xz.rb")
allow(asset).to receive(:depends_on).and_return(empty_depends_on_stub)
shutup do
Hbc::Installer.new(asset).install
end
expect(Hbc.caskroom.join("container-xz", asset.version)).to be_a_directory
expect(Hbc.appdir.join("container-xz--#{asset.version}")).to be_a_file
end
it "works with lzma-based Casks" do
skip("unlzma not installed") if which("unlzma").nil?
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-lzma.rb")
allow(asset).to receive(:depends_on).and_return(empty_depends_on_stub)
shutup do
Hbc::Installer.new(asset).install
end
expect(Hbc.caskroom.join("container-lzma", asset.version)).to be_a_directory
expect(Hbc.appdir.join("container-lzma--#{asset.version}")).to be_a_file
end
it "works with gpg-based Casks" do
skip("gpg not installed") if which("gpg").nil?
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-gpg.rb")
allow(asset).to receive(:depends_on).and_return(empty_depends_on_stub)
shutup do
Hbc::Installer.new(asset).install
end
expect(Hbc.caskroom.join("container-gpg", asset.version)).to be_a_directory
expect(Hbc.appdir.join("container")).to be_a_file
end
it "blows up on a bad checksum" do
bad_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/bad-checksum.rb")
expect {

View File

@ -1,4 +1,4 @@
describe "brew cask", :integration_test, :needs_macos, :needs_official_cmd_taps do
describe "brew cask", :integration_test, :needs_macos, :needs_network do
describe "list" do
it "returns a list of installed Casks" do
setup_remote_tap("caskroom/cask")

View File

@ -1,4 +1,4 @@
describe "brew services", :integration_test, :needs_macos, :needs_official_cmd_taps do
describe "brew services", :integration_test, :needs_macos, :needs_network do
it "allows controlling services" do
setup_remote_tap "homebrew/services"

View File

@ -1,25 +0,0 @@
require "gpg"
describe Gpg do
subject { described_class }
describe "::create_test_key" do
it "creates a test key in the home directory" do
skip "GPG Unavailable" unless subject.available?
mktmpdir do |dir|
ENV["HOME"] = dir
shutup do
subject.create_test_key(dir)
end
if subject.version == Version.create("2.0")
expect(dir/".gnupg/secring.gpg").to be_a_file
else
expect(dir/".gnupg/pubring.kbx").to be_a_file
end
end
end
end
end

View File

@ -1,9 +0,0 @@
cask 'container-air' do
version '0.1'
sha256 '554472e163f8a028629b12b468e29acda9f16b223dff74fcd218bba73cc2365a'
url "file://#{TEST_FIXTURE_DIR}/cask/container.air"
homepage 'https://example.com/container-air'
app 'container.app'
end

View File

@ -1,12 +0,0 @@
cask 'container-gpg' do
version '1.2.3'
sha256 :no_check
url "file://#{TEST_FIXTURE_DIR}/cask/container.tar.xz.gpg"
gpg :embedded, key_id: 'B0976E51E5C047AD0FD051294E402EBF7C3C6A71'
homepage 'https://example.com/container-gpg'
depends_on formula: 'gpg'
app 'container'
end

View File

@ -1,11 +0,0 @@
cask 'container-lzma' do
version '1.2.3'
sha256 '9d7edb32d02ab9bd9749a5bde8756595ea4cfcb1da02ca11c30fb591d4c1ed85'
url "file://#{TEST_FIXTURE_DIR}/cask/container.lzma"
homepage 'https://example.com/container-lzma'
depends_on formula: 'lzma'
app 'container-lzma--1.2.3'
end

View File

@ -1,11 +0,0 @@
cask 'container-rar' do
version '1.2.3'
sha256 '419af7864c0e1f125515c49b08bd22e0f7de39f5285897c440fe03c714871763'
url "file://#{TEST_FIXTURE_DIR}/cask/container.rar"
homepage 'https://example.com/container-rar'
depends_on formula: 'unar'
app 'container'
end

View File

@ -1,11 +0,0 @@
cask 'container-sit' do
version '1.2.3'
sha256 '0d21a64dce625044345c8ecca888e5439feaf254dac7f884917028a744f93cf3'
url "file://#{TEST_FIXTURE_DIR}/cask/container.sit"
homepage 'https://example.com/container-sit'
depends_on formula: 'unar'
app 'container'
end

View File

@ -1,11 +0,0 @@
cask 'container-xz' do
version '1.2.3'
sha256 '839263f474edde1d54a9101606e6f0dc9d963acc93f6dcc5af8d10ebc3187c02'
url "file://#{TEST_FIXTURE_DIR}/cask/container.xz"
homepage 'https://example.com/container-xz'
depends_on formula: 'xz'
app 'container-xz--1.2.3'
end

View File

@ -676,8 +676,7 @@ _brew_test_bot() {
}
# brew tests [-v] [--coverage] [--generic] [--no-compat]
# [--only=test_script:test_method] [--seed seed] [--trace] [--online]
# [--official-cmd-taps]:
# [--only=test_script:test_method] [--seed seed] [--trace] [--online]:
_brew_tests() {
_arguments \
'(-v)-v' \
@ -687,8 +686,7 @@ _brew_tests() {
'(--only)--only=-:test_method: ' \
'(--seed)--seed:seed: ' \
'(--trace)--trace' \
'(--online)--online' \
'(--official-cmd-taps)--official-cmd-taps'
'(--online)--online'
}
# brew uninstall, rm, remove [--force] formula:

View File

@ -845,10 +845,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
If `--no-compat` is passed, do not load the compatibility layer when
running tests.
If `--online` is passed, include tests that use the GitHub API.
If `--official-cmd-taps` is passed, include tests that use any of the
taps for official external commands.
If `--online` is passed, include tests that use the GitHub API and tests
that use any of the taps for official external commands.
* `update-test` [`--commit=``commit`] [`--before=``date`] [`--to-tag`] [`--keep-tmp`]:
Runs a test of `brew update` with a new repository clone.

View File

@ -879,10 +879,7 @@ If \fB\-\-generic\fR is passed, only run OS\-agnostic tests\.
If \fB\-\-no\-compat\fR is passed, do not load the compatibility layer when running tests\.
.
.IP
If \fB\-\-online\fR is passed, include tests that use the GitHub API\.
.
.IP
If \fB\-\-official\-cmd\-taps\fR is passed, include tests that use any of the taps for official external commands\.
If \fB\-\-online\fR is passed, include tests that use the GitHub API and tests that use any of the taps for official external commands\.
.
.TP
\fBupdate\-test\fR [\fB\-\-commit=\fR\fIcommit\fR] [\fB\-\-before=\fR\fIdate\fR] [\fB\-\-to\-tag\fR] [\fB\-\-keep\-tmp\fR]