[Zope3-checkins] CVS: Zope3/utilities - unittestgui.py:1.12
Jim Fulton
jim@zope.com
Fri, 18 Oct 2002 05:11:35 -0400
Update of /cvs-repository/Zope3/utilities
In directory cvs.zope.org:/tmp/cvs-serv4757
Added Files:
unittestgui.py
Log Message:
Added back at Tres' requuest.
=== Zope3/utilities/unittestgui.py 1.11 => 1.12 === (555/655 lines abridged)
--- /dev/null Fri Oct 18 05:11:35 2002
+++ Zope3/utilities/unittestgui.py Fri Oct 18 05:11:35 2002
@@ -0,0 +1,652 @@
+#!/usr/bin/env python
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""
+GUI framework and application for use with Python unit testing framework.
+Execute tests written using the framework provided by the 'unittest' module.
+
+Further information is available in the bundled documentation, and from
+
+ http://pyunit.sourceforge.net/
+
+Copyright (c) 1999, 2000, 2001 Steve Purcell
+This module is free software, and you may redistribute it and/or modify
+it under the same terms as Python itself, so long as this copyright message
+and disclaimer are retained in their original form.
+
+IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
+THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
+
+THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS,
+AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
+SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+"""
+
+__author__ = "Steve Purcell (stephen_purcell@yahoo.com)"
+__version__ = "$Revision$"[11:-2]
+
+import linecache
+import unittest
+import ScrolledText
+import sys
+import Tkinter
[-=- -=- -=- 555 lines omitted -=- -=- -=-]
+ self.canvas.bind(sequence, callback, add)
+
+ def unbind(self, sequence):
+ "Bindings should be propagated to the contained canvas."
+ tk.Frame.unbind(self, sequence)
+ self.canvas.unbind(sequence)
+
+ def bind_class(self, className, sequence=None, callback=None, add=None):
+ "Bindings should be propagated to the contained canvas."
+ tk.Frame.bind_class(self, className, sequence, callback, add)
+ self.canvas.bind_class(className, sequence, callback, add)
+
+ def unbind_class(self, className, sequence):
+ "Bindings should be propagated to the contained canvas."
+ tk.Frame.bind_class(self, className, sequence)
+ self.canvas.bind_class(className, sequence)
+
+ def paint(self, *args):
+ totalWidth = self.canvas.winfo_width()
+ width = int(self.fraction * float(totalWidth))
+ height = self.canvas.winfo_height()
+ if self.rect is not None: self.canvas.delete(self.rect)
+ if self.text is not None: self.canvas.delete(self.text)
+ self.rect = self.canvas.create_rectangle(0, 0, width, height,
+ fill=self.color)
+ if self.label:
+ label = self.label
+ else:
+ label = "%3.0f%%" % (100.0 * self.fraction)
+ self.text = self.canvas.create_text(totalWidth/2, height/2,
+ anchor=tk.CENTER,
+ text=label)
+
+def main(initialTestName="", minimal=0):
+ root = tk.Tk()
+ root.title("PyUnit")
+ runner = TkTestRunner(root, initialTestName, minimal)
+ root.protocol('WM_DELETE_WINDOW', root.quit)
+ root.mainloop()
+
+
+if __name__ == '__main__':
+ import sys
+ import getopt
+ opts, args = getopt.getopt(sys.argv[1:], 'm')
+ minimal = ('-m', '') in opts
+ if args:
+ main(args[0], minimal=minimal)
+ else:
+ main()