/[thuban]/branches/WIP-pyshapelib-bramz/test/runtests.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/test/runtests.py

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

revision 1219 by bh, Mon Jun 16 17:42:54 2003 UTC revision 1962 by bh, Wed Nov 19 15:46:22 2003 UTC
# Line 11  Main entry point for the Thuban test sui Line 11  Main entry point for the Thuban test sui
11  Just run this file as a python script to execute all tests  Just run this file as a python script to execute all tests
12  """  """
13    
14    __version__ = "$Revision$"
15    # $Source$
16    # $Id$
17    
18    import os
19    
20    # It should be possible to run the Thuban testsuite without an X
21    # connection, so we remove the DISPLAY environment variable which should
22    # lead to an error if the wxGTK module is imported accidentally. The
23    # DISPLAY variable is not always set so we catch and ignore the KeyError
24    try:
25        del os.environ["DISPLAY"]
26    except KeyError:
27        pass
28    
29  import os, sys  import sys
30  import warnings  import warnings
31  import unittest  import unittest
32    import getopt
33    
34  import support  import support
35  support.initthuban()  support.initthuban()
# Line 35  def main(): Line 50  def main():
50      warnings.filterwarnings("error", "The Layer attribute.*is deprecated",      warnings.filterwarnings("error", "The Layer attribute.*is deprecated",
51                              DeprecationWarning)                              DeprecationWarning)
52    
53      # Usage of the old table interface. This old interface is still used      verbosity = 1
     # by the test_table.py module which calls filterwarnings too to  
     # ignore the warnings issued by its own intended use of the old  
     # interface.  
     warnings.filterwarnings("error", ".*old table interface.*",  
                             DeprecationWarning)  
54    
55        opts, args = getopt.getopt(sys.argv[1:], 'v', ['verbose'])
56        for optchar, value in opts:
57            if optchar in ("-v", "--verbose"):
58                verbosity = 2
59            else:
60                print>>sys.stderr, "Unknown option", optchar
61    
62      # All Python files starting with test in the current directory      # All Python files starting with test in the current directory
63      # contain test cases.      # contain test cases.
64      # FIXME: It should be possible to run runtests.py even when not in      # FIXME: It should be possible to run runtests.py even when not in
65      # the test directory      # the test directory
66      files = os.listdir(os.curdir)      files = os.listdir(os.curdir)
67      names = []      if args:
68      for file in files:          names = args
69          if file[:4] == "test" and file[-3:] == ".py":      else:
70              names.append(file[:-3])          names = []
71            for file in files:
72                if file[:4] == "test" and file[-3:] == ".py":
73                    names.append(file[:-3])
74    
75      suite = unittest.defaultTestLoader.loadTestsFromNames(names)      suite = unittest.defaultTestLoader.loadTestsFromNames(names)
76      runner = unittest.TextTestRunner(verbosity = 2)      runner = support.ThubanTestRunner(verbosity = verbosity)
77      result = runner.run(suite)      result = support.execute_as_testsuite(runner.run, suite)
   
     support.print_garbage_information()  
78    
79      sys.exit(not result.wasSuccessful())      sys.exit(not result.wasSuccessful())
80    

Legend:
Removed from v.1219  
changed lines
  Added in v.1962

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26