mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #20079 from Homebrew/fix-tests-only-files
Filter `brew tests` spec files appropriately for each OS
This commit is contained in:
commit
5831783a85
@ -4,6 +4,7 @@
|
|||||||
require "formula_installer"
|
require "formula_installer"
|
||||||
require "unpack_strategy"
|
require "unpack_strategy"
|
||||||
require "utils/topological_hash"
|
require "utils/topological_hash"
|
||||||
|
require "utils/analytics"
|
||||||
|
|
||||||
require "cask/config"
|
require "cask/config"
|
||||||
require "cask/download"
|
require "cask/download"
|
||||||
|
@ -127,8 +127,8 @@ module Homebrew
|
|||||||
bundle_args << "--tag" << "~needs_network" unless args.online?
|
bundle_args << "--tag" << "~needs_network" unless args.online?
|
||||||
bundle_args << "--tag" << "~needs_ci" unless ENV["CI"]
|
bundle_args << "--tag" << "~needs_ci" unless ENV["CI"]
|
||||||
|
|
||||||
bundle_args = os_bundle_args(bundle_args)
|
bundle_args = os_bundle_args(bundle_args, generic: args.generic?)
|
||||||
files = os_files(files)
|
files = os_files(files, generic: args.generic?)
|
||||||
|
|
||||||
puts "Randomized with seed #{seed}"
|
puts "Randomized with seed #{seed}"
|
||||||
|
|
||||||
@ -156,11 +156,12 @@ module Homebrew
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
sig { params(bundle_args: T::Array[String]).returns(T::Array[String]) }
|
sig { params(bundle_args: T::Array[String], generic: T::Boolean).returns(T::Array[String]) }
|
||||||
def os_bundle_args(bundle_args)
|
def os_bundle_args(bundle_args, generic:)
|
||||||
# for generic tests, remove macOS or Linux specific tests
|
# for generic tests, remove macOS or Linux specific tests
|
||||||
non_linux_bundle_args(non_macos_bundle_args(bundle_args))
|
non_linux_bundle_args(non_macos_bundle_args(bundle_args))
|
||||||
end
|
end
|
||||||
|
alias generic_os_bundle_args os_bundle_args
|
||||||
|
|
||||||
sig { params(bundle_args: T::Array[String]).returns(T::Array[String]) }
|
sig { params(bundle_args: T::Array[String]).returns(T::Array[String]) }
|
||||||
def non_macos_bundle_args(bundle_args)
|
def non_macos_bundle_args(bundle_args)
|
||||||
@ -175,11 +176,12 @@ module Homebrew
|
|||||||
bundle_args << "--tag" << "~needs_linux" << "--tag" << "~needs_systemd"
|
bundle_args << "--tag" << "~needs_linux" << "--tag" << "~needs_systemd"
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(files: T::Array[String]).returns(T::Array[String]) }
|
sig { params(files: T::Array[String], generic: T::Boolean).returns(T::Array[String]) }
|
||||||
def os_files(files)
|
def os_files(files, generic:)
|
||||||
# for generic tests, remove macOS or Linux specific files
|
# for generic tests, remove macOS or Linux specific files
|
||||||
non_linux_files(non_macos_files(files))
|
non_linux_files(non_macos_files(files))
|
||||||
end
|
end
|
||||||
|
alias generic_os_files os_files
|
||||||
|
|
||||||
sig { params(files: T::Array[String]).returns(T::Array[String]) }
|
sig { params(files: T::Array[String]).returns(T::Array[String]) }
|
||||||
def non_macos_files(files)
|
def non_macos_files(files)
|
||||||
|
@ -11,10 +11,19 @@ module OS
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
sig { params(bundle_args: T::Array[String]).returns(T::Array[String]) }
|
sig { params(bundle_args: T::Array[String], generic: T::Boolean).returns(T::Array[String]) }
|
||||||
def os_bundle_args(bundle_args)
|
def os_bundle_args(bundle_args, generic:)
|
||||||
|
return generic_os_bundle_args(bundle_args, generic:) if generic
|
||||||
|
|
||||||
non_macos_bundle_args(bundle_args)
|
non_macos_bundle_args(bundle_args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { params(files: T::Array[String], generic: T::Boolean).returns(T::Array[String]) }
|
||||||
|
def os_files(files, generic:)
|
||||||
|
return generic_os_files(files, generic:) if generic
|
||||||
|
|
||||||
|
non_macos_files(files)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -11,10 +11,19 @@ module OS
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
sig { params(bundle_args: T::Array[String]).returns(T::Array[String]) }
|
sig { params(bundle_args: T::Array[String], generic: T::Boolean).returns(T::Array[String]) }
|
||||||
def os_bundle_args(bundle_args)
|
def os_bundle_args(bundle_args, generic:)
|
||||||
|
return generic_os_bundle_args(bundle_args, generic:) if generic
|
||||||
|
|
||||||
non_linux_bundle_args(bundle_args)
|
non_linux_bundle_args(bundle_args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { params(files: T::Array[String], generic: T::Boolean).returns(T::Array[String]) }
|
||||||
|
def os_files(files, generic:)
|
||||||
|
return generic_os_files(files, generic:) if generic
|
||||||
|
|
||||||
|
non_linux_files(files)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -19,7 +19,7 @@ RSpec.describe Cask::Artifact::Artifact, :cask do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "without target" do
|
context "without target" do
|
||||||
it "fails to load" do
|
it "fails to load", :no_api do
|
||||||
expect do
|
expect do
|
||||||
Cask::CaskLoader.load("invalid-generic-artifact-no-target")
|
Cask::CaskLoader.load("invalid-generic-artifact-no-target")
|
||||||
end.to raise_error(Cask::CaskInvalidError, /Generic Artifact.*requires.*target/)
|
end.to raise_error(Cask::CaskInvalidError, /Generic Artifact.*requires.*target/)
|
||||||
|
@ -6,7 +6,7 @@ RSpec.describe Cask::Artifact::Manpage, :cask do
|
|||||||
context "without section" do
|
context "without section" do
|
||||||
let(:cask_token) { "invalid-manpage-no-section" }
|
let(:cask_token) { "invalid-manpage-no-section" }
|
||||||
|
|
||||||
it "fails to load a cask without section" do
|
it "fails to load a cask without section", :no_api do
|
||||||
expect { cask }.to raise_error(Cask::CaskInvalidError, /is not a valid man page name/)
|
expect { cask }.to raise_error(Cask::CaskInvalidError, /is not a valid man page name/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -503,7 +503,7 @@ RSpec.describe Cask::Audit, :cask do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "livecheck should be skipped" do
|
describe "livecheck should be skipped", :no_api do
|
||||||
let(:only) { ["livecheck_version"] }
|
let(:only) { ["livecheck_version"] }
|
||||||
let(:online) { true }
|
let(:online) { true }
|
||||||
let(:message) { /Version '[^']*' differs from '[^']*' retrieved by livecheck\./ }
|
let(:message) { /Version '[^']*' differs from '[^']*' retrieved by livecheck\./ }
|
||||||
|
@ -24,7 +24,7 @@ RSpec.describe Cask::CaskLoader::FromTapLoader do
|
|||||||
expect { described_class.new("foo/bar/baz").load(config: nil) }.to raise_error(Cask::CaskUnavailableError)
|
expect { described_class.new("foo/bar/baz").load(config: nil) }.to raise_error(Cask::CaskUnavailableError)
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with sharded Cask directory" do
|
context "with sharded Cask directory", :no_api do
|
||||||
let(:cask_path) { tap.cask_dir/cask_name[0]/"#{cask_name}.rb" }
|
let(:cask_path) { tap.cask_dir/cask_name[0]/"#{cask_name}.rb" }
|
||||||
|
|
||||||
it "returns a Cask" do
|
it "returns a Cask" do
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
RSpec.describe Cask::DSL, :cask do
|
RSpec.describe Cask::DSL, :cask, :no_api do
|
||||||
let(:cask) { Cask::CaskLoader.load(token) }
|
let(:cask) { Cask::CaskLoader.load(token) }
|
||||||
let(:token) { "basic-cask" }
|
let(:token) { "basic-cask" }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user