[Merge] lp:~jameinel/bzr/2.1.0b4-win32-fancy-rename-exception into lp:bzr
Vincent Ladeuil
v.ladeuil+lp at free.fr
Wed Nov 18 23:30:51 GMT 2009
>>>>> "martin" == Martin <gzlist at googlemail.com> writes:
martin> Review: Approve
martin> New test passes here. Really the create_file method is something
martin> that's needed on bzrlib.tests.TestCaseInTempDir as previously
martin> mentioned on the mailing list.
+1 on that.
Here is the version I use in a derived version of TestCaseInTempDir for
some scripts I wrote:
def create_file(self, content, file_name=None,
prefix='mytest', suffix='.tmp',
cleanup=True):
if file_name is None:
fileno, file_name = tempfile.mkstemp(suffix=suffix,
prefix=prefix)
f = os.fdopen(fileno, 'w+')
else:
f = open(file_name, 'w+')
try:
f.write(content)
finally:
f.close()
if cleanup:
self.addCleanup(os.remove, file_name)
return file_name
<cough> tests needed :)
Vincent
More information about the bazaar
mailing list