From fd03aa527d1a4a44f202a9841b6b4e05ee6065b6 Mon Sep 17 00:00:00 2001 From: Samuel John Date: Thu, 13 Jun 2013 15:52:23 +0200 Subject: 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. --- Library/Formula/fontforge.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Library/Formula/fontforge.rb') 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 -- cgit v1.2.3