aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authorSamuel John2013-06-13 15:52:23 +0200
committerSamuel John2013-09-05 15:26:57 +0200
commitfd03aa527d1a4a44f202a9841b6b4e05ee6065b6 (patch)
treed92c005f499a500f016647f2f0a8a8001240282d /Library/Formula
parentc54f879fbf53c7742d252c2534868538488a2fa9 (diff)
downloadhomebrew-fd03aa527d1a4a44f202a9841b6b4e05ee6065b6.tar.bz2
Improve python tests for brew bots
Allow `build.with?` and similar methods to be used during the test phase. The BuildOptions (`build`) are initialized with the `Tab.used_options` unless explicitly overwritten on the command line. So basically `build.with?` works in `def install` and in `test do` as one would naively expect. (For the test, gramatically it should be `built.with?` but who cares) If a formula was installed `--with-python`, now the tests are also run `--with-python`. This enables us to use the `python do ... end` in a meaningful manner. Using `python do ... end` blocks for the tests, because the bot.brew.sh has system python per default and we need to set the PYTHONPATH for the test. Potentially to different values for Python 2.x and 3.x.
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/enchant.rb14
-rw-r--r--Library/Formula/fontforge.rb8
-rw-r--r--Library/Formula/libvirt.rb10
-rw-r--r--Library/Formula/libxml2.rb5
-rw-r--r--Library/Formula/omniorb.rb3
-rw-r--r--Library/Formula/portmidi.rb4
-rw-r--r--Library/Formula/pygtkglext.rb4
-rw-r--r--Library/Formula/pygtksourceview.rb4
-rw-r--r--Library/Formula/shiboken.rb6
9 files changed, 24 insertions, 34 deletions
diff --git a/Library/Formula/enchant.rb b/Library/Formula/enchant.rb
index 2d331c8e0..2a99f0571 100644
--- a/Library/Formula/enchant.rb
+++ b/Library/Formula/enchant.rb
@@ -21,28 +21,24 @@ class Enchant < Formula
"--prefix=#{prefix}",
"--disable-ispell",
"--disable-myspell"
- system "make install"
+ system "make", "install"
- if build.with? 'python'
+ python do
# Now we handle the python bindings from the subformulae PyEnchant
PyEnchant.new.brew do
# Don't download and install distribute now
inreplace 'setup.py', "distribute_setup.use_setuptools()", ""
- python do
ENV['PYENCHANT_LIBRARY_PATH'] = lib/'libenchant.dylib'
system python, 'setup.py', 'install', "--prefix=#{prefix}",
'--single-version-externally-managed',
'--record=installed.txt'
- end
end
end
end
- def test
- if build.with? 'python'
- python do
- system python, "-c", "import enchant; d=enchant.Dict('en_US'); print(d.suggest('homebrew'))"
- end
+ test do
+ python do
+ system python, "-c", "import enchant; d=enchant.Dict('en_US'); print(d.suggest('homebrew'))"
end
end
end
diff --git a/Library/Formula/fontforge.rb b/Library/Formula/fontforge.rb
index bb8d9b7fe..dbe0688fe 100644
--- a/Library/Formula/fontforge.rb
+++ b/Library/Formula/fontforge.rb
@@ -85,12 +85,10 @@ class Fontforge < Formula
system "make install"
end
- def test
+ test do
system "#{bin}/fontforge", "-version"
- if build.with? 'python'
- python do
- system python, "-c", "import fontforge"
- end
+ python do
+ system python, "-c", "import fontforge"
end
end
diff --git a/Library/Formula/libvirt.rb b/Library/Formula/libvirt.rb
index 6b88d28a2..f47bb0b7e 100644
--- a/Library/Formula/libvirt.rb
+++ b/Library/Formula/libvirt.rb
@@ -63,12 +63,10 @@ class Libvirt < Formula
end
test do
- if build.with? 'python'
- python do
- # Testing to import the mod because that is a .so file where linking
- # can break.
- system python, '-c', "import libvirtmod"
- end
+ python do
+ # Testing to import the mod because that is a .so file where linking
+ # can break.
+ system python, '-c', "import libvirtmod"
end
end
end
diff --git a/Library/Formula/libxml2.rb b/Library/Formula/libxml2.rb
index ff762f22e..f78d0a1c0 100644
--- a/Library/Formula/libxml2.rb
+++ b/Library/Formula/libxml2.rb
@@ -75,11 +75,8 @@ class Libxml2 < Formula
end
test do
- if build.with? 'python'
+ python do
system python, '-c', "import libxml2"
- else
- puts "No tests because built --without-python."
- true
end
end
end
diff --git a/Library/Formula/omniorb.rb b/Library/Formula/omniorb.rb
index 813da8ec3..a9b2a196e 100644
--- a/Library/Formula/omniorb.rb
+++ b/Library/Formula/omniorb.rb
@@ -38,8 +38,7 @@ class Omniorb < Formula
test do
system "#{bin}/omniidl", "-h"
-
- if build.with? 'python'
+ python do
system python, "-c", %(import omniORB; print 'omniORBpy', omniORB.__version__)
end
end
diff --git a/Library/Formula/portmidi.rb b/Library/Formula/portmidi.rb
index d24661f06..ccecfd766 100644
--- a/Library/Formula/portmidi.rb
+++ b/Library/Formula/portmidi.rb
@@ -43,8 +43,8 @@ class Portmidi < Formula
end
test do
- if build.with?('python') || Tab.for_name('portmidi').with?('python')
- system "python", "-c", "import pyportmidi; pyportmidi.init()"
+ python do
+ system python, "-c", "import pyportmidi; pyportmidi.init()"
end
end
diff --git a/Library/Formula/pygtkglext.rb b/Library/Formula/pygtkglext.rb
index 92e583bf8..326af30da 100644
--- a/Library/Formula/pygtkglext.rb
+++ b/Library/Formula/pygtkglext.rb
@@ -23,6 +23,8 @@ class Pygtkglext < Formula
end
test do
- system "python", "-c", "import pygtk", "pygtk.require('2.0')", "import gtk.gtkgl"
+ python do
+ system python, "-c", "import pygtk", "pygtk.require('2.0')", "import gtk.gtkgl"
+ end
end
end
diff --git a/Library/Formula/pygtksourceview.rb b/Library/Formula/pygtksourceview.rb
index 485df897f..fe8de6245 100644
--- a/Library/Formula/pygtksourceview.rb
+++ b/Library/Formula/pygtksourceview.rb
@@ -22,6 +22,8 @@ class Pygtksourceview < Formula
end
test do
- system "python", "-c", "import gtksourceview2"
+ python do
+ system python, "-c", "import gtksourceview2"
+ end
end
end
diff --git a/Library/Formula/shiboken.rb b/Library/Formula/shiboken.rb
index fe01e19b9..171a666a2 100644
--- a/Library/Formula/shiboken.rb
+++ b/Library/Formula/shiboken.rb
@@ -49,10 +49,8 @@ class Shiboken < Formula
end
test do
- if build.with? 'python'
- python do
- system python, "-c", "import shiboken"
- end
+ python do
+ system python, "-c", "import shiboken"
end
end
end