def make_test_file(content=None, suffix='.txt'):
 if (content is None):
  content = 'I am a test file for upload.'
 tdir = tempfile.gettempdir()
 file_for_upload = tempfile.NamedTemporaryFile(suffix=suffix, dir=tdir)
 file_for_upload.write(content)
 file_for_upload.seek(0)
 return file_for_upload

def make_test_file ( content = None , suffix = '.txt' ) : if ( content is None ) : content = 'I am a test file for upload.' tdir = tempfile . gettempdir ( ) file_for_upload = tempfile . NamedTemporaryFile ( suffix = suffix , dir = tdir ) file_for_upload . write ( content ) file_for_upload . seek ( 0 ) return file_for_upload
create a fake file for testing purposes .