From 79bbc97a189bea03392bff2ab6a819aca1fad0db Mon Sep 17 00:00:00 2001 From: John Chilton Date: Sat, 26 Dec 2015 12:37:21 +0000 Subject: [PATCH] Attempt to fix transiently failing capsule TS test. Guess here is that a flush is not occuring on that file because it is happening as part of garbage collection and not explictly as part of an explicit close. --- test/tool_shed/base/twilltestcase.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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=[] ):