/[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.13 by benja, Tue Oct 8 22:55:18 2002 UTC revision 1.14 by humppake, Wed Oct 9 06:50:26 2002 UTC
# Line 33  NOTE: testutil.py itself runs all tests Line 33  NOTE: testutil.py itself runs all tests
33    
34  import unittest, os.path, fnmatch, string, imp  import unittest, os.path, fnmatch, string, imp
35    
36    true = 1
37    false = 0
38    enableJNI = false
39    
40  def tests(files):  def tests(files):
41      """      """
42      Return a list of all *.test files in a given directory and its      Return a list of all *.test files in a given directory and its
# Line 71  def load(file): Line 75  def load(file):
75      tests = {}      tests = {}
76      exec compiledTestFile in globals(), tests      exec compiledTestFile in globals(), tests
77    
78        try:
79            if tests.keys().index('requiresJNI') >= 0:
80                if enableJNI == false:
81                    print file + " skipped: JNI required."
82                    return
83        except ValueError:
84            pass
85        
86      testnames = [t for t in tests.keys() if t.startswith('test')]      testnames = [t for t in tests.keys() if t.startswith('test')]
87    
88      code = '''class %s(unittest.TestCase):      code = '''class %s(unittest.TestCase):
# Line 118  def suite(files, omit=[]): Line 130  def suite(files, omit=[]):
130      omit -- files/subdirectories to avoid (defaults to empty list)      omit -- files/subdirectories to avoid (defaults to empty list)
131      """      """
132      return unittest.TestSuite([unittest.makeSuite(load(t))      return unittest.TestSuite([unittest.makeSuite(load(t))
133                                 for t in tests(files)])                                 for t in tests(files) if load(t)])
134    
135    
136  if __name__ == '__main__':  if __name__ == '__main__':
# Line 137  if __name__ == '__main__': Line 149  if __name__ == '__main__':
149                  gzz.util.dbg.option(o,a)                  gzz.util.dbg.option(o,a)
150    
151          test = args          test = args
152        try:
153            if test.index('jni') >=0:
154                enableJNI = true
155                test.remove('jni')
156        except ValueError:
157            pass
158      unittest.TextTestRunner(verbosity=2).run(suite(test))      unittest.TextTestRunner(verbosity=2).run(suite(test))
159    
160    
161    
162    
163    
164    
165    
166    

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

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