<s> import warnings <EOL> try : <EOL> from unittest . case import _ExpectedFailure as ExpectedFailure , _UnexpectedSuccess as UnexpectedSuccess <EOL> except ImportError : <EOL> from unittest2 . case import _ExpectedFailure as ExpectedFailure , _UnexpectedSuccess as UnexpectedSuccess <EOL> def install_proxy ( ) : <EOL> import nose . proxy <EOL> class MyResultProxy ( nose . proxy . ResultProxy ) : <EOL> def addExpectedFailure ( self , test , err ) : <EOL> self . assertMyTest ( test ) <EOL> plugins = self . plugins <EOL> plugins . addError ( self . test , ( ExpectedFailure , err , None ) ) <EOL> addExpectedFailure = getattr ( self . result , "<STR_LIT>" , None ) <EOL> if addExpectedFailure : <EOL> self . result . addExpectedFailure ( self . test , self . _prepareErr ( err ) ) <EOL> else : <EOL> warnings . warn ( "<STR_LIT>" , <EOL> RuntimeWarning ) <EOL> self . result . addSuccess ( self ) <EOL> def addUnexpectedSuccess ( self , test ) : <EOL> self . assertMyTest ( test ) <EOL> plugins = self . plugins <EOL> plugins . addError ( self . test , ( UnexpectedSuccess , None , None ) ) <EOL> self . result . addUnexpectedSuccess ( self . test ) <EOL> if self . config . stopOnError : <EOL> self . shouldStop = True <EOL> nose . proxy . ResultProxy = MyResultProxy <EOL> def install_result ( ) : <EOL> import nose . result <EOL> class MyTextTestResult ( nose . result . TextTestResult ) : <EOL> def addExpectedFailure ( self , test , err ) : <EOL> if ExpectedFailure in self . errorClasses : <EOL> storage , label , isfail = self . errorClasses [ ExpectedFailure ] <EOL> storage . append ( ( test , self . _exc_info_to_string ( err , test ) ) ) <EOL> self . printLabel ( label , ( ExpectedFailure , '<STR_LIT>' , None ) ) <EOL> def addUnexpectedSuccess ( self , test ) : <EOL> if UnexpectedSuccess in self . errorClasses : <EOL> storage , label , isfail = self . errorClasses [ UnexpectedSuccess ] <EOL> storage . append ( ( test , '<STR_LIT>' <EOL> '<STR_LIT>' ) ) <EOL> self . printLabel ( label , ( UnexpectedSuccess , '<STR_LIT>' , None ) ) <EOL> nose . result . TextTestResult = MyTextTestResult </s>
