#NEWLINE# def testTemporaryFilesGetCleanedUp( self ) : #NEWLINE# #INDENT# mapreduce_state = self . create_mapreduce_state ( output_params = { #NEWLINE# #INDENT# self . WRITER_CLS . BUCKET_NAME_PARAM : 'test' , #NEWLINE# #UNINDENT# } ) #NEWLINE# shard_state = self . create_shard_state ( 0 ) #NEWLINE# ctx = context . Context ( mapreduce_state . mapreduce_spec , shard_state ) #NEWLINE# context . Context . _set ( ctx ) #NEWLINE# writer = self . WRITER_CLS . create ( shard_state . mapreduce_spec , shard_state . shard_number , 0 ) #NEWLINE# writer . begin_slice ( None ) #NEWLINE# writer . write ( 'foo' ) #NEWLINE# writer = self . WRITER_CLS . from_json ( writer . to_json ( ) ) #NEWLINE# writer . write ( 'bar' ) #NEWLINE# writer = self . WRITER_CLS . from_json ( writer . to_json ( ) ) #NEWLINE# writer . write ( 'foo again' ) #NEWLINE# writer = self . WRITER_CLS . from_json ( writer . to_json ( ) ) #NEWLINE# writer . finalize ( ctx , shard_state ) #NEWLINE# names = [ l . filename for l in cloudstorage . listbucket ( '/test' ) ] #NEWLINE# self . assertEquals ( [ '/test/DummyMapReduceJobName/DummyMapReduceJobId/output-0' ] , names )