aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/pyqt.rb
diff options
context:
space:
mode:
authorJack Nagel2012-05-05 16:41:20 -0500
committerJack Nagel2012-05-05 16:43:34 -0500
commit387cbf046301c6458557bf0cf93828b85b1eb12b (patch)
tree65084ff1414b9b5bb72ebddc62539ff101b2f752 /Library/Formula/pyqt.rb
parente263b293c8d7eb1859e26d4a6ab785ab6d9738d9 (diff)
downloadhomebrew-387cbf046301c6458557bf0cf93828b85b1eb12b.tar.bz2
pyqt: clean up test
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Formula/pyqt.rb')
-rw-r--r--Library/Formula/pyqt.rb53
1 files changed, 23 insertions, 30 deletions
diff --git a/Library/Formula/pyqt.rb b/Library/Formula/pyqt.rb
index 0ed3a0ef2..1e16924a5 100644
--- a/Library/Formula/pyqt.rb
+++ b/Library/Formula/pyqt.rb
@@ -33,44 +33,37 @@ class Pyqt < Formula
end
def test
- test_program = <<-EOS
-#!/usr/bin/env python
-# Taken from: http://zetcode.com/tutorials/pyqt4/firstprograms/
+ # Reference: http://zetcode.com/tutorials/pyqt4/firstprograms/
+ mktemp do
+ ENV.prepend 'PYTHONPATH', "#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages", ':'
-import sys
-from PyQt4 import QtGui, QtCore
+ (Pathname.pwd/'test.py').write <<-EOS.undent
+ #!/usr/bin/env python
+ import sys
+ from PyQt4 import QtGui, QtCore
-class QuitButton(QtGui.QWidget):
- def __init__(self, parent=None):
- QtGui.QWidget.__init__(self, parent)
+ class QuitButton(QtGui.QWidget):
+ def __init__(self, parent=None):
+ QtGui.QWidget.__init__(self, parent)
- self.setGeometry(300, 300, 250, 150)
- self.setWindowTitle('Quit button')
+ self.setGeometry(300, 300, 250, 150)
+ self.setWindowTitle('Quit button')
- quit = QtGui.QPushButton('Close', self)
- quit.setGeometry(10, 10, 60, 35)
+ quit = QtGui.QPushButton('Close', self)
+ quit.setGeometry(10, 10, 60, 35)
- self.connect(quit, QtCore.SIGNAL('clicked()'),
- QtGui.qApp, QtCore.SLOT('quit()'))
+ self.connect(quit, QtCore.SIGNAL('clicked()'),
+ QtGui.qApp, QtCore.SLOT('quit()'))
+ app = QtGui.QApplication(sys.argv)
+ qb = QuitButton()
+ qb.show()
+ app.exec_()
+ sys.exit(0)
+ EOS
-app = QtGui.QApplication(sys.argv)
-qb = QuitButton()
-qb.show()
-app.exec_()
-sys.exit(0)
- EOS
-
- ohai "Writing test script 'test_pyqt.py'."
- open("test_pyqt.py", "w+") do |file|
- file.write test_program
+ system "python", "test.py"
end
-
- ENV['PYTHONPATH'] = "#{HOMEBREW_PREFIX}/lib/python"
- system "python test_pyqt.py"
-
- ohai "Removing test script 'test_pyqt.py'."
- rm "test_pyqt.py"
end
end