Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: cleanup tests. #2746

Merged
merged 1 commit into from
Jun 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 2 additions & 8 deletions Library/Homebrew/dev-cmd/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -40,10 +38,6 @@ def tests
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"
Expand Down
13 changes: 0 additions & 13 deletions Library/Homebrew/test/cask/artifact/suite_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@
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
Expand Down
104 changes: 0 additions & 104 deletions Library/Homebrew/test/cask/installer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,45 +37,6 @@
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")

Expand All @@ -87,32 +48,6 @@
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")

Expand All @@ -135,45 +70,6 @@
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 {
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/test/cmd/cask_spec.rb
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/test/cmd/services_spec.rb
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
25 changes: 0 additions & 25 deletions Library/Homebrew/test/gpg_spec.rb

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions Library/Homebrew/test/support/fixtures/cask/Casks/container-gpg.rb

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions Library/Homebrew/test/support/fixtures/cask/Casks/container-rar.rb

This file was deleted.

11 changes: 0 additions & 11 deletions Library/Homebrew/test/support/fixtures/cask/Casks/container-sit.rb

This file was deleted.

11 changes: 0 additions & 11 deletions Library/Homebrew/test/support/fixtures/cask/Casks/container-xz.rb

This file was deleted.

6 changes: 2 additions & 4 deletions completions/zsh/_brew
Original file line number Diff line number Diff line change
Expand Up @@ -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' \
Expand All @@ -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:
Expand Down
6 changes: 2 additions & 4 deletions docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 1 addition & 4 deletions manpages/brew.1
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down