Skip to content

Commit 206d6de

Browse files
authored
Merge pull request #2521 from MikeMcQuaid/tests-reduce-noise
tests: reduce some noise.
2 parents 10d70aa + a6df701 commit 206d6de

File tree

7 files changed

+17
-8
lines changed

7 files changed

+17
-8
lines changed

Library/Homebrew/dev-cmd/tests.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ def tests
3333
ENV["HOMEBREW_DEVELOPER"] = "1"
3434
ENV["HOMEBREW_NO_COMPAT"] = "1" if ARGV.include? "--no-compat"
3535
ENV["HOMEBREW_TEST_GENERIC_OS"] = "1" if ARGV.include? "--generic"
36-
ENV["HOMEBREW_NO_GITHUB_API"] = "1" unless ARGV.include? "--online"
36+
37+
if ARGV.include? "--online"
38+
ENV["HOMEBREW_TEST_ONLINE"] = "1"
39+
else
40+
ENV["HOMEBREW_NO_GITHUB_API"] = "1"
41+
end
3742

3843
if ARGV.include? "--official-cmd-taps"
3944
ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"] = "1"

Library/Homebrew/test/cask/cli/style_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
end
8282

8383
context "version" do
84-
it "matches `HOMEBREW_RUBOCOP_VERSION`" do
84+
it "matches `HOMEBREW_RUBOCOP_VERSION`", :needs_network do
8585
stdout, status = Open3.capture2("gem", "dependency", "rubocop-cask", "--version", HOMEBREW_RUBOCOP_CASK_VERSION, "--pipe", "--remote")
8686

8787
expect(status).to be_a_success

Library/Homebrew/test/cask/cli/uninstall_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313

1414
it "tries anyway on a non-present Cask when --force is given" do
1515
expect {
16-
Hbc::CLI::Uninstall.run("local-caffeine", "--force")
16+
shutup do
17+
Hbc::CLI::Uninstall.run("local-caffeine", "--force")
18+
end
1719
}.not_to raise_error
1820
end
1921

Library/Homebrew/test/cmd/bundle_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
describe "brew bundle", :integration_test, :needs_test_cmd_taps do
22
describe "check" do
3-
it "checks if a Brewfile's dependencies are satisfied" do
3+
it "checks if a Brewfile's dependencies are satisfied", :needs_network do
44
setup_remote_tap "homebrew/bundle"
55

66
HOMEBREW_REPOSITORY.cd do

Library/Homebrew/test/dev-cmd/pull_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
.and be_a_failure
77
end
88

9-
it "fetches a patch from a GitHub commit or pull request and applies it" do
10-
skip "Requires network connection." if ENV["HOMEBREW_NO_GITHUB_API"]
11-
9+
it "fetches a patch from a GitHub commit or pull request and applies it", :needs_network do
1210
CoreTap.instance.path.cd do
1311
shutup do
1412
system "git", "init"

Library/Homebrew/test/missing_formula_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
end
140140

141141
context "::deleted_reason" do
142-
subject { described_class.deleted_reason(formula) }
142+
subject { described_class.deleted_reason(formula, silent: true) }
143143

144144
before do
145145
Tap.clear_cache

Library/Homebrew/test/spec_helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@
6161
skip "Python not installed." unless which("python")
6262
end
6363

64+
config.before(:each, :needs_network) do
65+
skip "Requires network connection." unless ENV["HOMEBREW_TEST_ONLINE"]
66+
end
67+
6468
config.around(:each) do |example|
6569
begin
6670
TEST_DIRECTORIES.each(&:mkpath)

0 commit comments

Comments
 (0)