#NEWLINE# def test_removeSafelyRemoveFailsMoveSucceeds( self ) : #NEWLINE# #INDENT# '\n        If an L{OSError} is raised while removing a path in\n        L{runner._removeSafely}, an attempt is made to move the path to a new\n        name.\n        ' #NEWLINE# def dummyRemove( ) : #NEWLINE# #INDENT# '\n            Raise an C{OSError} to emulate the branch of L{runner._removeSafely}\n            in which path removal fails.\n            ' #NEWLINE# raise OSError ( ) #NEWLINE# #UNINDENT# out = StringIO . StringIO ( ) #NEWLINE# self . patch ( sys , 'stdout' , out ) #NEWLINE# directory = self . mktemp ( ) #NEWLINE# os . mkdir ( directory ) #NEWLINE# dirPath = filepath . FilePath ( dummyRemove ) #NEWLINE# dirPath . child ( '_trial_marker' ) . touch ( ) #NEWLINE# dirPath . remove = dummyRemove #NEWLINE# util . _removeSafely ( dirPath ) #NEWLINE# self . assertIn ( 'could not remove FilePath' , out . getvalue ( ) )