<s> import traceback <EOL> class TestListener ( object ) : <EOL> def on_test_suite_start ( self , test_suite ) : <EOL> pass <EOL> def on_test_suite_finish ( self , test_suite ) : <EOL> pass <EOL> def on_test_class_start ( self , test_class ) : <EOL> pass <EOL> def on_test_class_finish ( self , test_class ) : <EOL> pass <EOL> def on_test_group_start ( self , test_group ) : <EOL> pass <EOL> def on_test_group_finish ( self , test_group ) : <EOL> pass <EOL> def on_test_case_start ( self , test_case ) : <EOL> pass <EOL> def on_test_case_finish ( self , test_case ) : <EOL> pass <EOL> class TestListenerGroup ( object ) : <EOL> def __init__ ( self ) : <EOL> self . __test_listeners = [ ] <EOL> self . __teamcity_test_listener = None <EOL> def append ( self , test_listener ) : <EOL> if test_listener . __class__ . __name__ == "<STR_LIT>" and test_listener . __class__ . __module__ == "<STR_LIT:__main__>" : <EOL> self . __teamcity_test_listener = test_listener <EOL> else : <EOL> self . __test_listeners . append ( test_listener ) <EOL> def on_test_suite_start ( self , test_suite ) : <EOL> if self . __teamcity_test_listener : <EOL> self . __teamcity_test_listener . on_test_suite_start ( test_suite ) <EOL> for test_listener in self . __test_listeners : <EOL> try : <EOL> test_listener . on_test_suite_start ( test_suite ) <EOL> except Exception : <EOL> from . plogger import pconsole <EOL> pconsole . write_line ( "<STR_LIT>" <EOL> % ( test_listener . __class__ . __module__ , test_listener . __class__ . __name__ , traceback . format_exc ( ) ) ) <EOL> def on_test_suite_finish ( self , test_suite ) : <EOL> for test_listener in self . __test_listeners : <EOL> try : <EOL> test_listener . on_test_suite_finish ( test_suite ) <EOL> except Exception : <EOL> from . plogger import pconsole <EOL> pconsole . write_line ( "<STR_LIT>" <EOL> % ( test_listener . __class__ . __module__ , test_listener . __class__ . __name__ , traceback . format_exc ( ) ) ) <EOL> if self . __teamcity_test_listener : <EOL> self . __teamcity_test_listener . on_test_suite_finish ( test_suite ) <EOL> def on_test_class_start ( self , test_class ) : <EOL> if self . __teamcity_test_listener : <EOL> self . __teamcity_test_listener . on_test_class_start ( test_class ) <EOL> for test_listener in self . __test_listeners : <EOL> try : <EOL> test_listener . on_test_class_start ( test_class ) <EOL> except Exception : <EOL> from . plogger import pconsole <EOL> pconsole . write_line ( "<STR_LIT>" <EOL> % ( test_listener . __class__ . __module__ , test_listener . __class__ . __name__ , traceback . format_exc ( ) ) ) <EOL> def on_test_class_finish ( self , test_class ) : <EOL> for test_listener in self . __test_listeners : <EOL> try : <EOL> test_listener . on_test_class_finish ( test_class ) <EOL> except Exception : <EOL> from . plogger import pconsole <EOL> pconsole . write_line ( "<STR_LIT>" <EOL> % ( test_listener . __class__ . __module__ , test_listener . __class__ . __name__ , traceback . format_exc ( ) ) ) <EOL> if self . __teamcity_test_listener : <EOL> self . __teamcity_test_listener . on_test_class_finish ( test_class ) <EOL> def on_test_group_start ( self , test_group ) : <EOL> if self . __teamcity_test_listener : <EOL> self . __teamcity_test_listener . on_test_group_start ( test_group ) <EOL> for test_listener in self . __test_listeners : <EOL> try : <EOL> test_listener . on_test_group_start ( test_group ) <EOL> except Exception : <EOL> from . plogger import pconsole <EOL> pconsole . write_line ( "<STR_LIT>" <EOL> % ( test_listener . __class__ . __module__ , test_listener . __class__ . __name__ , traceback . format_exc ( ) ) ) <EOL> def on_test_group_finish ( self , test_group ) : <EOL> for test_listener in self . __test_listeners : <EOL> try : <EOL> test_listener . on_test_group_finish ( test_group ) <EOL> except Exception : <EOL> from . plogger import pconsole <EOL> pconsole . write_line ( "<STR_LIT>" <EOL> % ( test_listener . __class__ . __module__ , test_listener . __class__ . __name__ , traceback . format_exc ( ) ) ) <EOL> if self . __teamcity_test_listener : <EOL> self . __teamcity_test_listener . on_test_group_finish ( test_group ) <EOL> def on_test_case_start ( self , test_case ) : <EOL> if self . __teamcity_test_listener : <EOL> self . __teamcity_test_listener . on_test_case_start ( test_case ) <EOL> for test_listener in self . __test_listeners : <EOL> try : <EOL> test_listener . on_test_case_start ( test_case ) <EOL> except Exception : <EOL> from . plogger import pconsole <EOL> pconsole . write_line ( "<STR_LIT>" <EOL> % ( test_listener . __class__ . __module__ , test_listener . __class__ . __name__ , traceback . format_exc ( ) ) ) <EOL> def on_test_case_finish ( self , test_case ) : <EOL> for test_listener in self . __test_listeners : <EOL> try : <EOL> test_listener . on_test_case_finish ( test_case ) <EOL> except Exception : <EOL> from . plogger import pconsole <EOL> pconsole . write_line ( "<STR_LIT>" <EOL> % ( test_listener . __class__ . __module__ , test_listener . __class__ . __name__ , traceback . format_exc ( ) ) ) <EOL> if self . __teamcity_test_listener : <EOL> self . __teamcity_test_listener . on_test_case_finish ( test_case ) <EOL> test_listeners = TestListenerGroup ( ) </s>
