Added tests for python caveats
This commit is contained in:
parent
9218d3014d
commit
ae02b9776a
@ -196,7 +196,7 @@ class Caveats
|
|||||||
s << " #{f.plist_manual}"
|
s << " #{f.plist_manual}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# pbpaste pastes the system clipboard tool on macOS and fails with `tmux` by default
|
# pbpaste is the system clipboard tool on macOS and fails with `tmux` by default
|
||||||
# check if this is being run under `tmux` to avoid failing
|
# check if this is being run under `tmux` to avoid failing
|
||||||
if ENV["TMUX"] && !quiet_system("/usr/bin/pbpaste")
|
if ENV["TMUX"] && !quiet_system("/usr/bin/pbpaste")
|
||||||
s << "" << "WARNING: brew services will fail when run under tmux."
|
s << "" << "WARNING: brew services will fail when run under tmux."
|
||||||
|
|||||||
@ -28,7 +28,7 @@ describe Caveats do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "#caveats" do
|
describe "#caveats" do
|
||||||
context "when f.plist is not nil" do
|
context "when f.plist is not nil", :needs_macos do
|
||||||
it "prints plist startup information when f.plist_startup is not nil" do
|
it "prints plist startup information when f.plist_startup is not nil" do
|
||||||
f = formula do
|
f = formula do
|
||||||
url "foo-1.0"
|
url "foo-1.0"
|
||||||
@ -201,5 +201,45 @@ describe Caveats do
|
|||||||
expect(caveats).to include(HOMEBREW_PREFIX/"share/fish/vendor_completions.d")
|
expect(caveats).to include(HOMEBREW_PREFIX/"share/fish/vendor_completions.d")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "python caveats" do
|
||||||
|
before do
|
||||||
|
(f.prefix.resolved_path/"lib/python2.7/site-packages").mkpath
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when f is not keg_only" do
|
||||||
|
let(:f) {
|
||||||
|
formula do
|
||||||
|
url "foo-1.0"
|
||||||
|
end
|
||||||
|
}
|
||||||
|
let(:caveats) { described_class.new(f).caveats }
|
||||||
|
let(:user_site_packages) { Language::Python.user_site_packages("python") }
|
||||||
|
|
||||||
|
it "give commands to run when Homebrew's site-packages is not in Python sys.path" do
|
||||||
|
expect(caveats).to include("Homebrew's site-packages is not\nin your Python sys.path")
|
||||||
|
expect(caveats).to include(user_site_packages)
|
||||||
|
expect(caveats).to include("import site")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "gives commands to run when python pth files are installed" do
|
||||||
|
allow(Homebrew).to receive(:_system).and_return(true)
|
||||||
|
allow(Dir).to receive(:[]).with(any_args).and_return(["blah.pth"])
|
||||||
|
expect(caveats).to include(".pth files to Homebrew's site-packages and your\nPython isn't configured")
|
||||||
|
expect(caveats).to include(user_site_packages)
|
||||||
|
expect(caveats).to include("import site")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it "gives commands to run when formula is keg_only" do
|
||||||
|
f = formula do
|
||||||
|
url "foo-1.0"
|
||||||
|
keg_only "some reason"
|
||||||
|
end
|
||||||
|
caveats = described_class.new(f).caveats
|
||||||
|
homebrew_site_packages = Language::Python.homebrew_site_packages
|
||||||
|
expect(caveats).to include("echo #{f.opt_prefix}/lib/python2.7/site-packages >> #{homebrew_site_packages/f.name}.pth")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user