/[gzz]/gzz/test/testutil.py
ViewVC logotype

Diff of /gzz/test/testutil.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.26 by tjl, Tue Oct 15 09:43:00 2002 UTC revision 1.27 by tjl, Tue Oct 15 10:50:12 2002 UTC
# Line 30  can be tangled into unittests... Line 30  can be tangled into unittests...
30  NOTE: testutil.py itself runs all tests in test/ when run as main.  NOTE: testutil.py itself runs all tests in test/ when run as main.
31  """  """
32  import sys  import sys
33    import traceback
34  sys.path.insert(0, ".")  sys.path.insert(0, ".")
35    
36  import unittest, os.path, fnmatch, string, imp  import unittest, os.path, fnmatch, string, imp
37  import java  import java
38  from gzz.client import GraphicsAPI  from gzz.client import GraphicsAPI
39    
 graphicswindow = None  
 def getGraphicsWindow():  
     global graphicswindow  
     if not graphicswindow:  
         graphicswindow = GraphicsAPI.getInstance().createWindow()  
     return graphicswindow  
   
40  true = 1  true = 1
41  false = 0  false = 0
42  enableJNI = false  enableJNI = false
# Line 106  def load(file): Line 100  def load(file):
100              raise e              raise e
101            
102      tests["needGL"] = needGL      tests["needGL"] = needGL
     tests["getGraphicsWindow"] = getGraphicsWindow  
103      try:      try:
104          exec compiledTestFile in tests          exec compiledTestFile in tests
105      except NeedGLError, e:      except NeedGLError, e:
# Line 119  def load(file): Line 112  def load(file):
112              self.module = imp.new_module(%s)              self.module = imp.new_module(%s)
113              self.module.unittestObject = self              self.module.unittestObject = self
114              self.module.needGL = needGL              self.module.needGL = needGL
             self.module.getGraphicsWindow = getGraphicsWindow  
115              exec faildefs in self.module.__dict__              exec faildefs in self.module.__dict__
116              exec self.code in self.module.__dict__              exec self.code in self.module.__dict__
117      '''      '''
# Line 152  def load(file): Line 144  def load(file):
144    
145    
146  def docstring(obj):  def docstring(obj):
147      if obj.__doc__ != None: return '"""%s"""' % (obj.__doc__,)      if getattr(obj,"__doc__", None) != None:
148            return '"""%s"""' % (obj.__doc__,)
149      else: return ""      else: return ""
150    
151    
# Line 194  if __name__ == '__main__': Line 187  if __name__ == '__main__':
187              try:              try:
188                  unittest.TextTestRunner(verbosity=2).run(suite(test))                  unittest.TextTestRunner(verbosity=2).run(suite(test))
189              except:              except:
190                  print sys.exc_info()                  typ, val, tra = sys.exc_info()
191                    print (repr((typ, val, tra)))
192                    l = traceback.format_list(traceback.extract_tb(tra))
193                    print "\n".join(l)
194              java.lang.System.exit(0)              java.lang.System.exit(0)
195      GraphicsAPI.getInstance().startUpdateManager(Starter())      GraphicsAPI.getInstance().startUpdateManager(Starter())
196    

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26