diff --git a/test/tool_shed/base/twilltestcase.py b/test/tool_shed/base/twilltestcase.py index c69c2265283..7a677c6667b 100644 --- a/test/tool_shed/base/twilltestcase.py +++ b/test/tool_shed/base/twilltestcase.py @@ -539,7 +539,8 @@ class ShedTwillTestCase( TwillTestCase ): self.submit_form( 'export_repository', 'export_repository_button' ) fd, capsule_filename = tempfile.mkstemp() os.close( fd ) - file( capsule_filename, 'w' ).write( self.last_page() ) + with open( capsule_filename, 'w' ) as f: + f.write( self.last_page() ) return capsule_filename def fill_review_form( self, review_contents_dict, strings_displayed=[], strings_not_displayed=[] ):