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

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

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

revision 342 by bh, Fri Oct 18 17:28:46 2002 UTC revision 596 by bh, Thu Apr 3 11:37:01 2003 UTC
# Line 1  Line 1 
1  # Copyright (c) 2002 by Intevation GmbH  # Copyright (c) 2002, 2003 by Intevation GmbH
2  # Authors:  # Authors:
3  # Bernhard Herzog <[email protected]>  # Bernhard Herzog <[email protected]>
4  #  #
# Line 46  def initthuban(): Line 46  def initthuban():
46          import thubaninit          import thubaninit
47          _initthuban_done = 1          _initthuban_done = 1
48    
49  def run_suite(suite):  def run_tests():
50      """Run the test suite suite and return the result"""      """Frontend for unittest.main that prints some additional debug information
51      runner = unittest.TextTestRunner(verbosity = 2)  
52      return runner.run(suite)      After calling unittest.main, run the garbage collector and print
53        uncollected objects. Also print any un-unsubscribed messages.
54        """
55        try:
56            unittest.main()
57        finally:
58            # This has to be in a finally clause because unittest.main()
59            # ends with a sys.exit to make sure that the process exits with
60            # an appropriate exit code
61            print_garbage_information()
62    
63    def print_garbage_information():
64        """Print information about things that haven't been cleaned up.
65    
66        Run the garbage collector and print uncollected objects. Also print
67        any un-unsubscribed messages.
68        """
69        import gc, Thuban.Lib.connector
70        gc.collect()
71        if gc.garbage:
72            print
73            print "There are %d uncollected objects:" % len(gc.garbage)
74            print gc.garbage
75        Thuban.Lib.connector._the_connector.print_connections()
76    
77    
78  def create_temp_dir():  def create_temp_dir():

Legend:
Removed from v.342  
changed lines
  Added in v.596

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26