Speed up timing-out tests.

- make `brew readall` only check Homebrew/brew syntax with no tap
  passed.
- pass specified tap to `brew readall` test for speed
- only shell out once in `FormulaInfo` test for speed
This commit is contained in:
Mike McQuaid 2020-07-27 14:01:22 +01:00
parent 25db60ebbb
commit 047738069f
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
5 changed files with 16 additions and 41 deletions

View File

@ -19,7 +19,7 @@ module Homebrew
switch "--aliases",
description: "Verify any alias symlinks in each tap."
switch "--syntax",
description: "Syntax-check all of Homebrew's Ruby files."
description: "Syntax-check all of Homebrew's Ruby files (if no `<tap>` is passed)."
switch :verbose
switch :debug
end
@ -28,7 +28,7 @@ module Homebrew
def readall
readall_args.parse
if args.syntax?
if args.syntax? && args.no_named?
scan_files = "#{HOMEBREW_LIBRARY_PATH}/**/*.rb"
ruby_files = Dir.glob(scan_files).reject { |file| file =~ %r{/(vendor)/} }

View File

@ -6,7 +6,7 @@ describe "Homebrew.readall_args" do
it_behaves_like "parseable arguments"
end
describe "brew readall", :integration_test, timeout: 240 do
describe "brew readall", :integration_test do
it "imports all Formulae for a given Tap" do
formula_file = setup_test_formula "testball"
@ -15,7 +15,7 @@ describe "brew readall", :integration_test, timeout: 240 do
FileUtils.ln_s formula_file, alias_file
expect { brew "readall", "--aliases", "--syntax" }
expect { brew "readall", "--aliases", "--syntax", CoreTap.instance.name }
.to be_a_success
.and not_to_output.to_stdout
.and not_to_output.to_stderr

View File

@ -7,41 +7,16 @@ describe FormulaInfo, :integration_test do
it "tests the FormulaInfo class" do
install_test_formula "testball"
expect(
described_class.lookup(Formula["testball"].path)
.revision,
).to eq(0)
info = described_class.lookup(Formula["testball"].path)
expect(info).not_to be_nil
expect(info.revision).to eq(0)
expect(info.bottle_tags).to eq([])
expect(info.bottle_info).to be_nil
expect(info.bottle_info_any).to be_nil
expect(info.any_bottle_tag).to be_nil
expect(info.version(:stable).to_s).to eq("0.1")
expect(
described_class.lookup(Formula["testball"].path)
.bottle_tags,
).to eq([])
expect(
described_class.lookup(Formula["testball"].path)
.bottle_info,
).to eq(nil)
expect(
described_class.lookup(Formula["testball"].path)
.bottle_info_any,
).to eq(nil)
expect(
described_class.lookup(Formula["testball"].path)
.any_bottle_tag,
).to eq(nil)
expect(
described_class.lookup(Formula["testball"].path)
.version(:stable).to_s,
).to eq("0.1")
version = described_class.lookup(Formula["testball"].path)
.version(:stable)
expect(
described_class.lookup(Formula["testball"].path)
.pkg_version,
).to eq(PkgVersion.new(version, 0))
version = info.version(:stable)
expect(info.pkg_version).to eq(PkgVersion.new(version, 0))
end
end

View File

@ -379,7 +379,7 @@ items or checking if any current formulae/casks have Ruby issues.
* `--aliases`:
Verify any alias symlinks in each tap.
* `--syntax`:
Syntax-check all of Homebrew's Ruby files.
Syntax-check all of Homebrew's Ruby files (if no `*`tap`*` is passed).
### `reinstall` [*`options`*] *`formula`*

View File

@ -498,7 +498,7 @@ Verify any alias symlinks in each tap\.
.
.TP
\fB\-\-syntax\fR
Syntax\-check all of Homebrew\'s Ruby files\.
Syntax\-check all of Homebrew\'s Ruby files (if no \fB<tap>\fR is passed)\.
.
.SS "\fBreinstall\fR [\fIoptions\fR] \fIformula\fR"
Uninstall and then install \fIformula\fR using the same options it was originally installed with, plus any appended brew formula options\.