Skip to content

Commit

Permalink
Add test coverage for #628
Browse files Browse the repository at this point in the history
  • Loading branch information
jordansissel committed Mar 7, 2014
1 parent 0877582 commit e507658
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions spec/fpm/package/python_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require "spec_setup"
require "fpm" # local
require "fpm/package/python" # local
require "find" # stdlib

def python_usable?
return program_exists?("python") && program_exists?("easy_install")
Expand Down Expand Up @@ -126,4 +127,29 @@ def python_usable?
end
end
end

context "python_scripts_executable is set" do
it "should have scripts with a custom hashbang line" do
subject.attributes[:python_scripts_executable] = "fancypants"
subject.input("django")
found = false
Find.find(subject.staging_path) do |path|
next unless path =~ /bin\/django-admin\.py$/

# TODO(sissel): This will find all files like bin/django-admin.py.
# There are usually two. THe one that came with django and the one
# that was installed by python usually outside the python module itself
# and additionally usually in something like /usr/local/bin

fd = File.new(path, "r")
topline = fd.readline
fd.close
if topline.chomp == "#!fancypants"
found = true
end
break
end
insist { found } == true
end
end
end # describe FPM::Package::Python

0 comments on commit e507658

Please sign in to comment.