/[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.10 by tjl, Fri Sep 6 11:04:58 2002 UTC revision 1.11 by tjl, Mon Sep 30 22:20:28 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  def tests(dir):  def tests(files):
37      """      """
38      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
39      subdirectories.      subdirectories.
# Line 45  def tests(dir): Line 45  def tests(dir):
45          list.extend(names)          list.extend(names)
46    
47      tests = []      tests = []
48      os.path.walk(dir, addTests, tests)      for f in files:
49            if os.path.isdir(f):
50                os.path.walk(f, addTests, tests)
51            else:
52                tests.append(f)
53      return tests      return tests
54    
55  faildefs = compile("""  faildefs = compile("""
# Line 106  def docstring(obj): Line 110  def docstring(obj):
110    
111    
112    
113  def suite(dir):  def suite(files):
114      """Create a test suite for all .tests in a given directory."""      """Create a test suite for all .tests in a given directory."""
115      return unittest.TestSuite([unittest.makeSuite(load(t))      return unittest.TestSuite([unittest.makeSuite(load(t))
116                                 for t in tests(dir)])                                 for t in tests(files)])
117    
118    
119  if __name__ == '__main__':  if __name__ == '__main__':
120      unittest.TextTestRunner(verbosity=2).run(suite('test/'))      import sys
121        test = ['test/']
122        if len(sys.argv) > 1:
123            test = sys.argv[1:]
124        unittest.TextTestRunner(verbosity=2).run(suite(test))
125    

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

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